神刀安全网

UIImagePickerController breaks status bar appearance

As Rich86man mentioned here , the following is a possible solution.

In the view controller who calls the image picker, set yourself as the delegate of the image Picker. (You’re probably already doing this)

UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];

imagePicker.delegate = self;

Since UIImagePickerController is a type of Navigation controller, you’re also setting yourself as the UINavigationController delegate. Then :

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

Replace UIStatusBarStyleLightContent with whatever style you are looking for.

However, in my case, I found it would be fine just adding a line of code(only add as you need) in - viewWillAppear: function.

[[UIApplication sharedApplication] setStatusBarHidden:NO]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES]; 

Each time UIImagePickerController dismissed, - viewWillAppear: would be called and set status bar right.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » UIImagePickerController breaks status bar appearance

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址