X3

RedSky

导航

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{
  NSLog("你点击了按钮!");
}

 

posted on 2019-02-19 15:38  HotSky  阅读(134)  评论(0编辑  收藏  举报