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