Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Alex Puray
1,304 PointsTransferring Image Data From Camera View To Another View.
Hello! I'm trying to create different ways to transfer image data to another view. For example... I create a button that accesses the camera and the camera view pops up and the user can take a photo. After the photo is taken and you click "Use Photo" I want the photo come up on a different view so the user can edit, filters, etc. Any help would be greatly appreciated!
Thank you.
2 Answers
Stone Preston
42,016 Pointsimplement prepare for segue to pass information between view controllers. You implement it in the view controller you want to pass the information from.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"usePhoto"])
{
UsePhotoViewController *viewController = (UsePhotoViewController *)segue.destinationViewController
//Assuming you have already set a photo property in the current view controller, and have a photo property defined in your destination controller
viewController.photo = self.photo;
}
}
Assuming you are using storyboards, you would have to set up this "usePhoto" segue by control + clicking and dragging from your show photo button to the show photo view controller and setting the segue identifier to usePhoto.
Alex Puray
1,304 PointsThank You!
Stone Preston
42,016 Pointsno problem.