NoobiOS
NoobiOS

Reputation: 25

iOS: Access UIImageView placed in Interface Builder from code

I've placed some images in my interface with Interface Builder and set them to be hidden on startup... Now I want to change the hidden attribute to FALSE, when I press a button, but I haven't tried accessing interface built images in my code before (not even sure if it is possible)...

Any help?

Upvotes: 2

Views: 775

Answers (1)

tnull
tnull

Reputation: 758

Just create some IBOutlets in your code, connect them in Interface Builder and then use them in your code.

e.g.

//in your header:

IBOutlet UIImageView *image;

// in your code (e.g. in the IBAction for the button):
- (IBAction)showImageNowFoo:(id)sender {
    [image setHidden:NO];
}

btw: FALSE is false. NO is Objective-C (although FALSE works..)

Upvotes: 2

Related Questions