开发者

UIImagePickerController didFinishPickingMediaWithInfo not being called

开发者 https://www.devze.com 2023-02-20 18:21 出处:网络
I\'m having trouble with using a UIImagePickerController. Basically, though the picker is being displayed fine, the UIImagePickerController didFinishPickingMediaWithInfo method is refusing to be calle

I'm having trouble with using a UIImagePickerController. Basically, though the picker is being displayed fine, the UIImagePickerController didFinishPickingMediaWithInfo method is refusing to be called (I've tried NSLogging all the way through, it just doesn't get called). Here's my code (I've defined imgPicker in the header as an 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:UIImagePi开发者_StackOverflow社区ckerControllerEditedImage];
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

Anyone have any idea as to why it isn't being called?


Have you set the delegate property of UIImagePickerController , if not do as below

myImagePickerController.delegate = self;

also confirm with the UIImagePickerControllerDelegate protocol,

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号