Reputation: 3685
I have a UIImagePickerController which I am using in Ipad though when you select one of the images nothing happens here is the code for the picker:
- (IBAction)addPicture:(id)sender {
CGRect rect = CGRectMake(0, 0, 753, 118);
[popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:nil];
patientPicture = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImageView *pictureView = (UIImageView *)[imageCell viewWithTag:777];
pictureView.image = patientPicture;
[_imgViewAdd reloadInputViews];
}
-(void)viewDidLoad {
pickerController = [[UIImagePickerController alloc] init];
popOverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
popOverController.delegate = self;
}
What happens is the imagepicker loads fine though when I go to pick one of the pictures nothing happens at all
Thanks in advance
Upvotes: 2
Views: 1146
Reputation: 446
You can try this (it worked for me ) :
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSLog(@"didFinishPickingMediaWithInfo CALLED");
[picker dismissViewControllerAnimated:YES completion:^{
testImageView.image = (UIImage*) [info objectForKey:UIImagePickerControllerEditedImage]; //testImageView is a UIImageView
}];
Upvotes: 0
Reputation: 6918
Call:
[self dismissViewControllerAnimated:YES completion:nil];
last instead of first.
Also...
@interface yourViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
You didn't set the pickerController delegate...
pickerController.delegate = self;
Because you have a popover use this..
[popOverController dismissPopoverAnimated:YES];
Upvotes: 1