Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does UIImage have an equivalent of myLabel.hidden = YES?

I'd like to hide an UIImage with a code in a method ... then display something else in its place and then re-enable it again. How would I go about doing this ?

I know how to do this with UILabels (myLabel.hidden = YES) but not with UIImage

thank you!

like image 652
EarlGrey Avatar asked Dec 08 '10 04:12

EarlGrey


1 Answers

Make sure that your UIImage is enclosed inside of a UIImageView:

UIImage *theImage = [UIImage imageNamed:@"someImageName.png"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:theImage];

self.imageView = imgView; // assuming you have a property called imageView

[imgView release];

[self.view addSubview:self.imageView]; //in your view controller

once you've done this, you can use:

[self.imageView setHidden:YES];
like image 112
Sam Ritchie Avatar answered Oct 09 '22 04:10

Sam Ritchie