我使用下面的代碼從相機或照片庫中選擇圖像。在iOS 8中,它很好地挑選圖像。但在iOS 9中。顯示選擇器視圖但不選擇圖像。甚至沒有回到控制器。點擊圖片什麼都不做。我究竟做錯了什麼。UIImagePickerController不在iOS中選取圖像9
- (void)showImgaePickerViewForSourceType:(UIImagePickerControllerSourceType)sourceType
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.allowsEditing = YES;
imagePickerController.delegate = self;
self.imgPickerController = imagePickerController;
if (IS_IPAD) {
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:self.imgPickerController];
[popover presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2-200, self.view.frame.size.height/2 - 300, 400, 400) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
self.popOver = popover;
}];
}else{
[self presentViewController:self.imgPickerController animated:YES completion:NULL];
}
}
你是否實現了圖像選取器的委託方法? – cekisakurek
是的,我說它在iOS 8中正常工作。 – user2096064
然後向我們展示你的委託方法的實現。他們叫嗎? – jcaron