After searching on Google about this confusion, I found out that the best place to put an IBOutlet
is:
@interface GallantViewController : UIViewController
@property (nonatomic, weak) IBOutlet UISwitch *switch;
@end
but from what I say, now the switch
variable is visible outside of the GallantViewController
. Isn't that odd? I thought that this wrong method:
@interface GoofusViewController : UIViewController {
IBOutlet UISwitch *_switch
}
@end
was behaving like this, and moving it would fix it. Why would you want to manipulate a button for example from another class instead of implementing it's logic just in the GallantViewController
?