UIImagePickerController在iOS 8中无法正确显示 [英] UIImagePickerController is not presenting correctly in iOS 8

查看:106
本文介绍了UIImagePickerController在iOS 8中无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用以下代码呈现一个UIImagePickerController:

I'd like to present an UIImagePickerController with the following code:

self.pickerController = [[UIImagePickerController alloc] init];
self.pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.pickerController.delegate = self;

[self presentViewController:self.pickerController animated:YES completion:nil];

它适用于iOS 7及以下版本,但在iOS 8中我遇到以下故障:

It's working fine for iOS 7 and below, but in iOS 8 I got the following glitch:


  1. 在转换到图像选择器控制器(垂直封面动画)时,拾取器控制器的背景颜色是不可见的,显示了呈现视图控制器下方。转换完成后,选择器的表视图将突然显示而不显示动画。

  1. While transitioning to the image picker controller (vertical cover animation), the background colour of the picker controller is invisible, revealing the presenting view controller beneath. After transition is finished, the picker's table view will be displayed abruptly without animation.

有时,选择器的表视图根本不显示,而是我得到的一个空白的黑色屏幕。导航栏仍然存在,但没有任何条形按钮项,因此用户必须强制退出应用程序。

Sometimes, the picker's table view is not displayed at all, and instead I got a blank black screen. The navigation bar is still there, but no bar button items whatsoever, so user has to force quit the application.

有人知道这里发生了什么吗?

Anyone know what's going on here?

推荐答案

所以我设法找到了原因并解决了这些问题并想在此处记录:

So I managed to find the cause and fix for these problems and want to document it here:


  1. 当我尝试从XCode 5.1编译到iOS 8设备时出现第一个问题。我切换到XCode 6 beta 2,现在它正常工作。

  1. The first problem occurred when I tried to compile to iOS 8 device from XCode 5.1. I switched to XCode 6 beta 2 and now it's working just fine.

当我尝试重用之前显示的UIImagePickerController时出现了第二个问题。在显示之前创建一个新实例,它将被修复。

The second problem occurred when I tried to reuse an UIImagePickerController that has been displayed before. Create a new instance instead before displaying, and it would be fixed.

干杯。

这篇关于UIImagePickerController在iOS 8中无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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