0

I have this app compiled for iOS 6.0 running on iOS 7.

I am trying to get rid of the status bar and I am almost there.

I have added this to info.plist

View controller-based status bar appearance = NO
Status bar is initially hidden = YES

I have added this code to the rootViewController

- (BOOL)prefersStatusBarHidden
{
    return YES;

}

Everything is fine. The app loads without the status bar but as soon as I present the UIImagePickerController from the rootViewController the status bar is back, even after the picker dismisses.

Yes, I have subclassed the UIImagePickerController and added the prefersStatusBarHidden to the class, just to see, but nothing changed.

How do I get rid of this abomination. Please save me.


EDIT: no,

[self setNeedsStatusBarAppearanceUpdate];

is not working

Duck
  • 34,902
  • 47
  • 248
  • 470

2 Answers2

2

Had this exact same problem in my app. Solution that worked - Assuming that the view controller that shows the UIImagePickerController implements the UINavigationControllerDelegate protocol. Implement this protocol method -

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{

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

}
Kedar
  • 1,298
  • 10
  • 20
  • Please mark the answer as correct if it helped resolve the problem. Thanks. – Kedar Oct 15 '13 at 00:14
  • you have to be patient in these cases cause answers cannot be accepted in the first 6 minutes... now it is accepted. – Duck Oct 15 '13 at 00:20
  • Sorry if I sounded impatient. I wasn't aware of the 6 minutes rule. Thanks for letting me know. – Kedar Oct 15 '13 at 00:25
  • No problem. I think the rule applies when the question is fresh and the answer comes within that time frame. – Duck Oct 15 '13 at 00:27