In my main view controller I have a button that prompts the user to select a photo from their photo library then display it (img), which looks like this:
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
[picker release];}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
img.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];}
My question is how can I also display this selected image in a second view controller? I know how to go to a different view, I’m just unsure how to send an image to that view.
Take this in .h file in SecondViewController
Make below function in seconviewcontroller
Now In first view controller do like this:
Please check spelling mistakes as I hand written this. Hope this help.