我正在使用以下代码显示 UIImagePickerController 来拍照:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:imagePicker animated:YES completion:nil];
注意:self 是嵌入在 Container View 中的 UIViewController,它本身参与了 UINavigationController
我还实现了以下方法:
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
[self.imgProfile setImage:image];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[self dismissViewControllerAnimated:YES completion:nil];
}
当我选择拍摄的照片或取消它时,UIImagePickerController 消失了,但主视图也消失了!淡入黑色。
我正在仅 iPad 的应用程序上为 iOS7 编写代码,以防它与它有关。
这是一个显示问题的视频。原谅模糊,但它在 NDA 之下。