I just need to trigger a UIButton programmatically . I have seen many of posts such as http://stackoverflow.com/questions/5625651/programmatically-fire-button-click-event
[btnLocations sendActionsForControlEvents:UIControlEventTouchDown];
This statement working fine in the " viewDidLoad " and also in another button handler.
-(void)viewDidLoad
{
[btnName2 sendActionsForControlEvents:UIControlEventTouchDown];
}
&&&&&&&
- (IBAction)btnName1:(id)sender {
[btnName2 sendActionsForControlEvents:UIControlEventTouchDown];
}
This works fine . but why it is not triggering from user defined method. Like this :
-(void) myMEthod
{
if(true)
{
[btnName2 sendActionsForControlEvents:UIControlEventTouchDown];
}
}
Simple one . But I didn't get the reason
I just need to know why it is not happening ?? And any alternative to achieve it?
Thanks.