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
Post a Comment