iOS 7 状态栏中的 UIImagePickerController

标签 uiimagepickercontroller ios7 uistatusbar

在 io7 中, View 顶部的状态栏是一场噩梦。幸运的是,我设法让它工作,因此它将被放置在 View 上方。我是这样做的:

- (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;
    }
....
}

现在我的状态栏在我的导航栏上方。

但是说到打电话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;
....
}

结果是:

enter image description here

相机上方的状态栏(显示相机拍照时)是否有可能控制?

谢谢你。

最佳答案

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

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

并在 appDelegate 中添加。
[application setStatusBarHidden:NO]; 
[application setStatusBarStyle:UIStatusBarStyleDefault]; 

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

关于iOS 7 状态栏中的 UIImagePickerController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19046070/

相关文章:

ios - IOS7状态栏和导航栏问题

path - 在 TinyMCE4 中删除状态栏中的路径

autolayout - 切换状态栏时如何重新定位导航/工具栏?

objective-c - ARC - 取消分配图片库选择器?

ios - -[UIImage长度] : unrecognized selector sent to instance error with a NSMutableArray with Images

iphone - 如何关闭uiimagePickerController?

iOS 自定义 url 方案未打开应用程序 Xcode 5

iOS 7 - 将数据从 SWRevealViewController 传递到 RearViewController

ios - 为什么纵向和横向的顶部栏高度不同?

iphone - UiImagePickerController takePicture 问题