iOS 7状态栏中的UIImagePickerController

The*_*s80 5 uiimagepickercontroller uistatusbar ios7

在io7中,视图顶部的状态栏是一场噩梦.我真的设法让它工作,所以它将被放置在视图上方.我这样做:

- (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;
    }
....
}
Run Code Online (Sandbox Code Playgroud)

现在我的状态栏位于我的导航栏上方.

但是当谈到调用的UIImagePickerController东西是不同的时.上面的代码没有任何效果.我试着这样做:

- (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;
....
}
Run Code Online (Sandbox Code Playgroud)

结果是:

在此输入图像描述

我的状态栏(在显示相机拍照时)是否有机会控制?

谢谢.

Dee*_*esh 16

我有同样的问题......并解决我的问题...在.plist文件中添加密钥

'View controller-based status bar appearance' and set to NO.
Run Code Online (Sandbox Code Playgroud)

并在appDelegate中添加.

[application setStatusBarHidden:NO]; 
[application setStatusBarStyle:UIStatusBarStyleDefault]; 
Run Code Online (Sandbox Code Playgroud)

注意: - **setStatusBarStyle**根据您的应用背景颜色更改