Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImagePickerController in iOS 7 status bar

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.

like image 480
Theodoros80 Avatar asked Sep 27 '13 08:09

Theodoros80


1 Answers

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

like image 151
Deepesh Avatar answered Nov 17 '22 05:11

Deepesh