5

In io7,the status bar on top a view is a nightmare.Fortunally i managed to make it work so it will be placed above the view.I did it like this:

- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
         self.view.backgroundColor=[UIColor colorWithRed:(152/255.0) green:(204/255.0) blue:(51/255.0) alpha:1] ;
        CGRect frame = self.topNav.frame; frame.origin.y = 20;
        self.topNav.frame = frame;
    }
....
}

Now my status bar is above my navigation bar.

But when it comes to calling UIImagePickerController things are different.The above code has no effect. I tried to do this:

- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{


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

 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {

            CGRect frame = self.imagePickerController.frame; frame.origin.y = 20;
           self.imagePickerController.frame = frame;
        }

    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    imagePickerController.sourceType = sourceType;
    imagePickerController.delegate = self;
    self.imagePickerController = imagePickerController;
    self.imagePickerController.allowsEditing=YES;
....
}

and the result is:

enter image description here

Any chance that my status bar(when displaying the camera for taking pictures) above the camera controls?

Thank you.

Theodoros80
  • 796
  • 2
  • 15
  • 43

5 Answers5

16

I have same problem... and solve my proble... Add The key in .plist file

'View controller-based status bar appearance' and set to NO.

And add in appDelegate.

[application setStatusBarHidden:NO]; 
[application setStatusBarStyle:UIStatusBarStyleDefault]; 

Note:- change the **setStatusBarStyle** according to your app background color

Deepesh
  • 8,065
  • 3
  • 28
  • 45
  • The new status bar is giving me headaches.I had to self.view.backgroundColor=[UIColor colorWithRed:(152/255.0) green:(204/255.0) blue:(51/255.0) alpha:1] ; for every view so it will color the status bar. – Theodoros80 Sep 27 '13 at 10:00
  • I tried as said above but its not working. is there any other things to be modified along with this – vamsi575kg Oct 10 '13 at 09:16
  • http://stackoverflow.com/a/18953517/1271057 this answer helped me to hide the status that overlaps the camera roll – vamsi575kg Oct 10 '13 at 11:00
  • you want to hide the status bar – Deepesh Oct 10 '13 at 11:31
  • Vamsi575g, what is the problem? i can post code but first tell me what 's the problem.I didn't had to hide the status bar,just draw the pickerController 20 points lower. [imagePickerController.view setFrame:CGRectMake(0, 20, 320, self.imagePickerController.view.frame.size.height - 20)]; – Theodoros80 Oct 11 '13 at 16:26
  • `'View controller-based status bar appearance'` must have a capital V. – tomjung Nov 20 '13 at 20:17
0

Set View controller-based status bar appearance' and set to NO.

And add in appDelegate.

[application setStatusBarHidden:NO]; [application setStatusBarStyle:UIStatusBarStyleDefault];

Trap87
  • 1
  • 1
0

try this

- (void)navigationController:(UINavigationController *)navigationController     willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}
Sumit Mundra
  • 3,891
  • 16
  • 29
0

In App's Info.plist file add:

"View controller-based status bar appearance" == NO

In appdelegae.m file,add following code in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [application setStatusBarHidden:NO];
  [application setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

}
Shams Ahmed
  • 4,498
  • 4
  • 21
  • 27
be.with.veeresh
  • 587
  • 4
  • 6
-1

This is a bug in iOS 7.0 and it's fixed in iOS 7.1

Fabio Costa
  • 213
  • 3
  • 8