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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -