iOS SDK - How to get the status bar back when using UIImagePickerController?

dan picture dan · Aug 22, 2010 · Viewed 33.5k times · Source

As soon as I add a UIImagePickerController sub view to my view the status bar disappears and I can't get it back. Is there any way to keep the status bar visible?

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;


[self.view addSubview:imagePicker.view];

[imagePicker viewWillAppear:YES];
[imagePicker viewDidAppear:YES];

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

Answer

Brad The App Guy picture Brad The App Guy · Sep 21, 2010

I had to do the same thing in a camera app as well. Apparently, in addition to setting the status bar to not be hidden, you also have to reset its style after the camera view makes it disappear. Try this:

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