Im trying to set a UIImageView from a segue, and for some reason the image is not getting set..
Heres the .h files of my class that subclassed a UIViewController
@interface PhotoDisplayViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *photoView;
-(void)setPhoto:(UIImage *)photo;
@end
and heres the setPhoto
-(void)setPhoto:(UIImage *)photo{
NSLog(@"PHOTO %@", photo);
_photoView.image = photo;
NSLog(@"MYPHOTO %@", _photoView.image);
}
when i call setPhoto from prepare for segue, i see this in the console
2012-12-16 13:26:22.129 TestApp[2183:907] PHOTO <UIImage: 0x1fd7cd80>
2012-12-16 13:26:22.130 TestApp[2183:907] MYPHOTO (null)
Why is this happening?
It looks like
_photoViewis probablynil. It may not be set when loading the nib. Make sure you’ve wired it up properly in IB. Or perhaps you are calling -setPhoto: before the view has loaded.