其他分享
首页 > 其他分享> > IOS笔记

IOS笔记

作者:互联网

1。button控件添加事件监听

//button控件添加事件监听

[button addTarget:方法对象 action:@select(方法[:(可选)]) forControlEvents:事件触发方式];
如:
[button addTarget:self action:@select(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
[button addTarget:self action:@select(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];

- (void) buttonClicked (UIButton *) button{
  printf("你点击了按钮!");
}

 

标签:button,forControlEvents,IOS,笔记,buttonClicked,action,addTarget,select
来源: https://www.cnblogs.com/RedSky/p/10401448.html