Objective C: Accessing properties of an IBOutlet
If I have a UIImageView in an .xib file called MainViewContro开发者_开发问答ller (which, of course, is linked with the respective MainViewController interface (.h) and implementation (.m) files), how can I change the image of the UIImageView from an entirely separate class?
I want to process all of the image initialisation from a separate class (there are a lot of images), but can't seem to figure out how to do it outside of MainViewController.m.
Any tips? Thanks.
Declare these ImageView as @property and access them in other classes.
@property (nonatomic, retain) IBOutlet UIImageView *image1;
In the implementation class
@synthesize image1;
Now you can use setter and getter from other classes to access these objects to play around.
加载中,请稍侯......
精彩评论