【发布时间】:2012-10-15 05:39:03
【问题描述】:
我目前正在开发一个在 iOS 6 中运行的 iPad 应用
我在我的应用中实现了 UIImagePickerController 的一个子类,它通过覆盖 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 和 - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 函数来强制相机处于横向。
在通过presentViewController 启动图像选择器时似乎有一个随机的机会,它会在相机“加载”屏幕上被捕获。那个看起来像一个关闭的相机快门。除非您退出或锁定/解锁屏幕,否则应用程序将在此屏幕上冻结,之后它将正常运行。
我还有一个用于相机视图的自定义 UI。但是我在添加之前就注意到了这个问题,所以我认为它是无关的。
这是我必须打开选择器的内容:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
self.modalController = [[CameraLandscapeImagePicker alloc] init];
self.modalController.delegate = self;
self.modalController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.modalController.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage, nil];
self.modalController.allowsEditing = NO;
[self.viewController presentViewController:modalController animated:YES completion:nil];
//add the overlaying view ui
[self.modalController buildCustomOverlay];
self.newMedia = YES;
}
感谢任何帮助。
[编辑] - 更新: 我已经设法弄清楚如何故意复制这个问题。以下是步骤:
- 点按我的应用“捕获”按钮以加载相机
- 退出相机界面
- 按 ipad 上的主页按钮
- 点击主屏幕上的图标再次打开应用
- 再次点按我的应用“捕获”按钮
- 相机卡在快门屏幕上
我还注意到即使连接到 xcode 也会发生这种情况。
我已经修改了我的代码,以便通过单例提供 UIImagePickerController 对象。以前我每次都创建一个新的 UIImagePickerController 对象。这没有任何影响,我仍然遇到同样的问题。 我已经让应用程序在快门屏幕上运行了大约 5 分钟,但它仍然卡住了。
【问题讨论】:
标签: ios ipad uiimagepickercontroller freeze