iphone - Call IBAction method from code -


i have button findtarget_btn on want call method moredetails. in viewdidload, writing

[findtarget_btn addtarget:self action:@selector(moredetails) forcontrolevents:uicontroleventtouchupinside]; 

but reason moredetails not getting called when click button? doing wrong?

also fine if call 2 methods on button; 1 via ib , other via code similar above ?

check how moredetails defined. likely, takes id sender parameter: in case should use @selector(moredetails:) (colon signature reflects presence of parameter in)

regarding second question: yes, can call other actions code. ibaction synonym void, it's no different other method.

edit
might have misunderstood second question. if want assign 1 action in ib , 1 in code, might not work. can create dedicated handler , call 2 methods sequentially it.

- (ibaction) findtargetclick:(id) sender {   [self handler1:sender];   [self moredetails:sender]; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -