I have a button that is initialized dynamically.. I want to disable that button from another UIViewController.
I am using this code:
The button is
@property (strong, nonatomic) IBOutlet UIButton *aboutus;
and then i try to disable it this way:
OtherViewController * view2 = [[OtherViewController alloc] initWithNibName:@"view2" bundle:nil];
view2.aboutus.enabled=NO;
but the button would still be enabled.. any ideas why?
You need a public
BOOLproperty:on
OtherViewController. Set that value to whatever you want (YES or NO) and then in viewDidLoad: