ios 绑定事件的回调

可以通过  (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; 

方法来绑定某个控件事件的回调,这里的action可以是任意个参数的方法,

但至多有三个有效信息,多于三个参数时,系统会顺序重复使用这三个参数。

使用示例:

[button addTarget:self action:@selector(buttonClick:otherinf:thirdinfo:fourinfo:)forControlEvents: UIControlEventTouchUpInside];

第一个参数是事件的发生者,第四个也是。

posted on 2014-02-13 16:40  tanglaoya321  阅读(372)  评论(0)    收藏  举报