I\'m getting an image from the user from the photo gallery, and I want to pass it to a another view...
I\'ve read that I should be able to simply do something like t
This solved the issue:
-(IBAction)sendImage:(id)sender
{
if(self.secondView == nil)
{
SecondView *secView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:[NSBundle mainBundle]];
self.secondView = secView;
secView.theImage = selectedImage.image;
}
[self.navigationController pushViewController:secondView animated:YES];
}
SecondView:
@interface SecondView : UIViewController
{
UIImageView *imgView;
UIImage *theImage;
}
@property (nonatomic, retain) IBOutlet UIImageView *imgView;
@property (nonatomic, retain) UIImage *theImage;
-(void)setImage:(UIImage *)image;
@end
and in the .m of secondView:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[imgView setImage:theImage];
}