UIImagePickerController解雇后导航栏无响应

时间:2015-05-20 18:08:07

标签: ios7 uinavigationcontroller uinavigationbar uiimagepickercontroller

仅在iOS 7上,我的应用程序中的导航栏在使用UIImagePickerController后无法响应任何触摸,然后被解除(无论是否已选择了图片)。导航栏下方的屏幕正常运行,但现在无法在应用程序中导航回来;用户被卡在此屏幕上。

我正在从代码中启动UIImagePickerController,尽管应用程序的其余部分都是在故事板中展示的。

UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
mediaUI.mediaTypes = [NSArray arrayWithObject:(NSString *) kUTTypeImage];
mediaUI.allowsEditing = NO;
mediaUI.delegate = self;
[controller presentModalViewController: mediaUI animated: YES];

提前感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

我希望您正确执行这些步骤!

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    [picker dismissViewControllerAnimated:YES completion:NULL];

}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {

    [picker dismissViewControllerAnimated:YES completion:NULL];

}

当你打电话时

 UIImagePickerController *picker = [[UIImagePickerController alloc] init];
 picker.delegate = self;
 picker.allowsEditing = YES;
 picker.sourceType = UIImagePickerControllerSourceTypeCamera;

<强> [self presentViewController:picker animated:YES completion:NULL];

干杯!

答案 1 :(得分:0)

我注意到日志显示“启动控制器的开始/结束外观转换的不平衡调用”。当它出现时,我立即从另一个控制器启动图像选择器控制器。这在iOS 8上运行正常但在iOS 7上需要延迟。我通过在短暂延迟后调用我的方法来修复它:

[self performSelector:@selector(takePicture) withObject:nil afterDelay:.1];