This works for UITextField and I'm sure other objects as well.
Hide an object
Here are the basics.
- In your .h file for your view. In the same section as @interface enter: IBOutlet UIImageView *imageBadInput;
- Just below the interface section enter: @property (nonatomic, retain) IBOutlet UIImageView *imageBadInput;
- Now move to the .m file for you view and after @implementation enter : @synthesize imageBadInput;
- In the body of this file enter the following to hide the object, and use the NO form to display it: imageBadInput.hidden = YES;
- Save these files (they will be grey in the list on the left if they are not saved).
- Open up Interface Builder with your nib (.xib) file. Ctrl-click and drag either the File Owner, or the ViewController (depends on how you are building your app).
- Drag the blue line over to the graphic you want, and drop it once highlighted.
- You now have the option to select the outlet you created in step 1
- If you have created several of them, they will all be available. Objects already connected have a "-" before them.
- Save the nib file, and build as normal.
- (void)viewDidLoad {
imageBadInput.hidden = YES;
}
No comments:
Post a Comment