Does UIImage have the equivalent of myLabel.hidden = YES?

I would like to hide the UIImage with the code in the method ... then display something else in its place and then turn it back on. How can i do this?

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

Thank you!

+5
source share
2 answers

Make sure yours is UIImageenclosed inside 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

as soon as you do this you can use:

[self.imageView setHidden:YES];
+11
source

You can do this similarly to UIImageView.

UIImages by themselves are not added / displayed in the view.

0
source

All Articles