UIImagePickerController is not presenting correctly in iOS 8

时光总嘲笑我的痴心妄想 提交于 2019-12-07 16:31:25

问题


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];

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

  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.

  2. 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?


回答1:


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

  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.

  2. 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.

Cheers.



来源:https://stackoverflow.com/questions/25929123/uiimagepickercontroller-is-not-presenting-correctly-in-ios-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!