开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜