I am studying the corresponding iOS 7 status byte, but I have to deal with the problem while I use UIImagePickerController . Allow editing This edit window shows 20 pixels of space on the top panel.
I used the code and first set the UIViewControllerBasedStatusBarAppearance to NO in info.plist and set the delegation method:
Appdelegate.h
@property (retain, nonatomic) UIWindow *background;
Appdelegate.m
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { [application setStatusBarStyle:UIStatusBarStyleLightContent]; self.window.clipsToBounds =YES; self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20); self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height); background = [[UIWindow alloc] initWithFrame: CGRectMake(0, 0, self.window.frame.size.width, 20)]; background.backgroundColor =[UIColor redColor]; [background setHidden:NO]; }
In my home controller, which has no effect, so I put in my home viewController one method to change the background color in the status bar:
-(void)viewWillLayoutSubviews{ if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { self.view.clipsToBounds = YES; CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenHeight = screenRect.size.height; self.view.frame = CGRectMake(0, 20, self.view.frame.size.width,screenHeight-20); self.view.bounds = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"userIsMale"]) { [tempWindow setBackgroundColor:[UIColor colorWithRed:(46.0/255.0) green:(134.0/255.0) blue:(255.0/255.0) alpha:1]]; } else { [tempWindow setBackgroundColor:[UIColor colorWithRed:(246.0/255.0) green:(26.0/255.0) blue:(113.0/255.0) alpha:1]]; } [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; }
Now, when I present the UIImagePickerController to allow an editing window that shows this as follows:

I tried to use this solution for a hidden status bar while UIImagePickerController is present:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { [[UIApplication sharedApplication] setStatusBarHidden:YES]; }
And show the status code in ViewWillApear .
I got this result:

Where am I doing wrong and how to solve it?