崩溃的iPad照片选取器 [英] Crash iPad Photo Picker

查看:118
本文介绍了崩溃的iPad照片选取器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下功能激活设备相机或图像选择器,具体取决于UIActionSheet的结果。如果fromCamera = YES则适用于iPhone和iPad。如果fromCamera = NO,那么它适用于iPhone并出现图像选择器。但它在iPad上崩溃时出现以下错误: UIStatusBarStyleBlackTranslucent在此设备上不可用。我已经知道iPad无法显示UIStatusBarStyleBlackTranslucent statusBar,但如何避免此崩溃?

I am using the following function to activate either the device camera or the image picker depending on the result of a UIActionSheet. if fromCamera=YES then it works on both iPhone and iPad. if fromCamera=NO then it works on iPhone and the image picker appears. But it crashes on the iPad with the following error: UIStatusBarStyleBlackTranslucent is not available on this device. I already know that the iPad can't display the UIStatusBarStyleBlackTranslucent statusBar, but how do I avoid this crash?

-(void)addPhotoFromCamera:(BOOL)fromCamera{

if(fromCamera){    
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
else{
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
}


[self presentModalViewController:picker animated:YES];

}

推荐答案

我怀疑UIImagePicker是从Info.plist文件或当前显示的视图控制器继承半透明状态栏。

I suspect the UIImagePicker is inheriting the translucent status bar from your Info.plist file or from the currently displayed view controller.

如果你做了app没有半透明的状态栏?

What happens if you make the app not have a translucent status bar?

这篇关于崩溃的iPad照片选取器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆