Assuming you're working with ARC:
Define it as a property in your class:
@property (nonantomic, strong) UIButton *myButton;
and assign it to that property in viewDidLoad:
UIButton *myBtn = [[UIButton alloc] init];
self.myButton = myBtn;
...
Question
I've made a custom button programmatically in
- (void)viewDidLoad
However I need to call one of its methods in
-(void) viewDidAppear:(BOOL)animated
I need to call
[self.custom setHidden:YES]
Is the buttons scope only in viewDidLoad
?
Solution
Assuming you're working with ARC:
Define it as a property in your class:
@property (nonantomic, strong) UIButton *myButton;
and assign it to that property in viewDidLoad:
UIButton *myBtn = [[UIButton alloc] init];
self.myButton = myBtn;
...