I am brand new to using UIImagePicker so bear with me here. Basically, I have two UIButtons defined that access the camera roll and once an image is chosen, the image appears in my UIImageView. The problem is when I choose an image from one of the buttons, it appears in both UIImageViews, and not one. I basically want to be able to choose two different photos by means of two different buttons. Here is the coding:
-(IBAction)getPhoto1:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; popover1 = [[UIPopoverController alloc] initWithContentViewController:picker]; [popover1 presentPopoverFromRect:CGRectMake(0.0, 0.0, 400., 400.0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } -(IBAction)getPhoto2:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; popover2 = [[UIPopoverController alloc] initWithContentViewController:picker]; [popover2 presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; } -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissViewControllerAnimated:YES completion:nil]; photo1.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; photo2.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; }