我在使用UIImagePickerController时遇到了问题。虽然选择器正常显示,但UIImagePickerController的didFinishPickingMediaWithInfo方法拒绝被调用(我已经尝试通过NSLog进行调试,但它就是不被调用)。以下是我的代码(我在头文件中定义了imgPicker作为一个UIImagePickerController):
-(IBAction)grabImage {
self.imgPicker = [[UIImagePickerController alloc] init];
self.imgPicker.allowsImageEditing = YES;
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:self.imgPicker animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
imgview.image = [info objectForKey:UIImagePickerControllerEditedImage];
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
有人知道为什么它没有被调用吗?