ios - Not Triggering event handler of UIButton from a Method -
i need trigger uibutton programmatically . have seen many of posts such http://stackoverflow.com/questions/5625651/programmatically-fire-button-click-event
[btnlocations sendactionsforcontrolevents:uicontroleventtouchdown];
this statement working fine in " viewdidload " , in button handler.
-(void)viewdidload { [btnname2 sendactionsforcontrolevents:uicontroleventtouchdown]; } &&&&&&& - (ibaction)btnname1:(id)sender { [btnname2 sendactionsforcontrolevents:uicontroleventtouchdown]; }
this works fine . why not triggering user defined method. :
-(void) mymethod { if(true) { [btnname2 sendactionsforcontrolevents:uicontroleventtouchdown]; } }
simple 1 . didn't reason
i need know why not happening ?? , alternative achieve it?
thanks.
could issue trying invoke ui event on thread. try adding this:
- (void)firebuttonevent:(id)unused { [btnname2 sendactionsforcontrolevents:uicontroleventtouchdown]; }
and call using
[self performselectoronmainthread:@selector(firebuttonevent:) withobject:nil waituntildone:false];
Comments
Post a Comment