UIImagePickerController in iOS 7 status bar

眉间皱痕 提交于 2019-11-28 04:44:09

问题


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:

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

Thank you.


回答1:


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




回答2:


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

And add in appDelegate.

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




回答3:


try this

- (void)navigationController:(UINavigationController *)navigationController     willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}



回答4:


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];

}



回答5:


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



来源:https://stackoverflow.com/questions/19046070/uiimagepickercontroller-in-ios-7-status-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!