ios - Create IBOutlets and IBActions programmatically -
this question has answer here:
i want create iboutlet
s , ibaction
s in code rather interface builder.
let's i've got button on ui called btndisplay
, , method in code called displaymessage
. code i'd have write make when btndisplay
tapped, displaymessage
runs?
the way no outlets give button tag in ib, 128. then:
uibutton *btndisplay = (uibutton *)[self.view viewwithtag:128]; [btndisplay addtarget:self action:@selector(pressedbtndisplay:) forcontrolevents:uicontroleventtouchupinside];
then implement:
- (void) pressedbtndisplay:(id)sender { }
Comments
Post a Comment