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 th开发者_StackOverflowis with UILabels (myLabel.hidden = YES) but not with UIImage
thank you!
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];
You can do that in the same way to an UIImageView.
UIImages by themselves do not get added/displayed in a view.
精彩评论