Search code examples
iosuiimagepickercontrollerios9statusbar

iOS 9 UIImagePickerController statusBar white


The target screenshot want

First,I have read those link

All of the links use those API of UIApplication

- setStatusBarStyle:animated:
- setStatusBarHidden:withAnimation:

But,those API are deprecated in iOS 9.

So,how to get lightContent statusBar in iOS 9?


Solution

  • I figure it out,just post my answer. Accept any better answer

    1. Set View controller-based status bar appearance to YES,or just delete this key in info.plist
    2. Make a subclass of UIImagePickerController

      @interface BaseImagePickerController : UIImagePickerController
      
      @end
      
      
      @implementation BaseImagePickerController
      -(UIStatusBarStyle)preferredStatusBarStyle{
          return UIStatusBarStyleLightContent; 
      }
      @end
      
    3. Use this subclass

      self.imagePikerViewController = [[BaseImagePickerController alloc] init];