Hiding the status bar for UIImagePickerController

Posted on Posted in IOS

The stock UIImagePickerController’s editing controls are under the status bar and therefore somewhat useless. Use the following category to hide the status bar:

#import "UIImagePickerController+RemoveStatusBar.h"

@implementation UIImagePickerController (RemoveStatusBar)

– (void)viewDidLoad

{
[super viewDidLoad];

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)   // iOS7+ only

{

self.edgesForExtendedLayout = UIRectEdgeNone;

[self prefersStatusBarHidden];

[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];

}

}

– (BOOL)prefersStatusBarHidden

{

return YES;

}

– (UIViewController *)childViewControllerForStatusBarHidden

{

return nil;

}

@end