Reputation: 3763
In my UIView
, i have a UIButton
displayed.
Inside same UIView class i have a method i'd like to be executed when button is pressed.
When everything is done programmatically, without the use of Interface Builder, how can one link the two together?
Upvotes: 4
Views: 1799
Reputation: 17445
Use the UIButton addTarget:action:forControlEvents: message to specify a selector for the UIControlEventTouchUpInside event.
[myButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
Upvotes: 10