UIImagePickerController camera view rotating strangely on iOS 8 (pictures)

后端 未结 12 1486
我寻月下人不归
我寻月下人不归 2020-12-07 16:34

I have a very simple application: - All orientations are permitted with only a button on a screen - The button show a UIImagePickerController (to take a photo)

12条回答
  •  孤城傲影
    2020-12-07 17:33

    Here's a fix I've found by adding this category to UIImagePickerController:

    @implementation UIImagePickerController (Rotation)
    
    - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator
    {
        [self viewWillAppear:NO];
        [self viewDidAppear:NO];
    }
    
    - (void)viewWillDisappear:(BOOL)animated
    {
        [[UIApplication sharedApplication] setStatusBarHidden:NO];
    }
    
    @end
    

    I realise it is hacky calling UIViewController lifecycle methods directly, but this is the only solution I've found. Hopefully Apple will fix this soon!

提交回复
热议问题