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.
精彩评论