tags:

views:

96

answers:

2

I'd like to control visibility on a simple UI element. If it was a button, I'd just call setHiden 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?

A: 

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

Costique
A: 

Shouldn't your image be in an image view?

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

Then you can use

imageView.hidden = YES;
Randy Simon
Ah, this was actually just a dumb mistake on my part. I was doing it all in IB, and mistakenly thought I was adding a UIImage when I was really adding a UIImageView.Thanks!
Michael F