如何实现自定义cell里面button的click事件
1个回答
推荐于2016-06-07 · 知道合伙人互联网行家
关注
展开全部
先说下代码怎么实现吧。取得cell里面的button(方法很多,最典型的就是tag)
然后就可以用下面的方法了。
addTarget:action:forControlEvents:
Adds a target and action for a particular event (or events) to an internal dispatch table.
- (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. See “Control Events” for bitmask constants.
Discussion
You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. The action message may optionally include the sender and the event as parameters, in that order.
Availability
Available in iOS 2.0 and later.
然后就可以用下面的方法了。
addTarget:action:forControlEvents:
Adds a target and action for a particular event (or events) to an internal dispatch table.
- (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. See “Control Events” for bitmask constants.
Discussion
You may call this method multiple times, and you may specify multiple target-action pairs for a particular event. The action message may optionally include the sender and the event as parameters, in that order.
Availability
Available in iOS 2.0 and later.
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询