如何制作UIImagePickerController StatusBar lightContent样式?

fol*_*lse 9 objective-c statusbar uiimagepickercontroller ios

在此输入图像描述

当我呈现ImagePickerController时,statusBar文本颜色仍为黑色,如何制作这样的?

fol*_*lse 42

只需三个步骤:

1:添加UINavigationControllerDelegate,UIImagePickerControllerDelegate到你的

@interface yourController ()<>
Run Code Online (Sandbox Code Playgroud)

2: imagePickerController.delegate = self;

3:

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
Run Code Online (Sandbox Code Playgroud)

  • 在iOS 9中不推荐使用`setStatusBarStyle` (3认同)