- (void)addTarget:(id)target //动作信息接收方,即处理信息的对象
action:(SEL)action
forControlEvents:(UIControlEvents)controlEvents
Parameters
target | The target object—that is, the object to which the action message is sent. If this is nil, the responder chain is searched for an object willing to respond to the action message. |
action | A selector identifying an action message. It cannot be NULL. |
controlEvents | A bitmask specifying the control events for which the action message is sent. SeeControl Events for bitmask constants. |
Discussion
Youmay call this method multiple times, and you may specify multiple target-actionpairs for a particular event. The action message may optionally include thesender and the event as parameters, in that order.
When you call this method, target is not retained.
该方法归属于UIControl类,其继承结构如下所示: