Very very weird problem with UIImageView property - I can access it then I can't, and it's not nil.
- by just_another_coder
Very very weird problem with UIImageView property on iPad application
@interface MyViewController : UIViewController {
IBOutlet UIImageView* coverImage;
}
@property(nonatomic, retain) IBOutlet UIImageView* coverImage;
… more code
@implementation MyViewController
@synthesize coverImage;
… more code
- (void)viewDidLoad {
[super viewDidLoad];
NSString* imageName = @"my_image.png";
UIImage* tempImage = [UIImage imageNamed:imageName];
[self.coverImage setImage:tempImage];
}
The above code WILL display the image.
In another part of code:
-(IBAction) stopButtonPressed:(id)sender {
[self.coverImage setHidden:YES];
NSLog(@"coverImage desc: %@", [coverImage description]);
}
The image will NOT disappear. I know the reference to the image isn't nil, because it gives me this output:
2010-05-29 17:37:40.706 MyApp[95360:207] coverImage desc: UIImageView: 0x5128420; frame = (0 0; 1024 768); autoresize = RM+BM; userInteractionEnabled = NO; layer = CALayer: 0x512bed0
In addition, if I move the code in viewDidLoad to another part of the class, and try to execute it from there, it fails to show the image at all.