开发者

what's the preferred visibility toggle for UIImage (like setHidden on UIButton)?

I'd like to control visibility on a simple UI element. If it was a button, I'd just call setHi开发者_Python百科den on it, but UIImage has no such method.

What's the preferred way of showing or hiding an image? Just making it a UIButton and not hooking it up to any methods seems wasteful.. is that really the right way to do it?


Shouldn't your image be in an image view?

UIImageView imageView = [[UIImageView alloc] initWithImage:myImage];

Then you can hide the image view with:

imageView.hidden = YES;


hidden is a property of UIView, so you can use it with UIImageViews.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜