ios - 为多个控件事件 UIButton 添加选择器

标签 ios uibutton

我可以在一行中为多个控制事件添加选择器吗?

类似[_recordButton addTarget:self action:@selector(myaction:) forControlEvents:@[UIControlEventTouchDragExit,UIControlEventTouchUpInside]];

最佳答案

控制事件是位标志:

[_recordButton addTarget:self action:@selector(myaction:) forControlEvents:UIControlEventTouchDragExit|UIControlEventTouchUpInside];

关于ios - 为多个控件事件 UIButton 添加选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24042409/

相关文章:

ios - RefreshControl 仅出现在水平 ScrollView (iOS)中的第一个子项之上

ios - swift - 在没有虚拟间隔 View 的情况下垂直居中多个 View

objective-c - 使用按钮更改 UIImage View 的图像

ios - 使用swift通过UI按钮创建对象实例

objective-c - UIBarButtonItem with UIButton as CustomView - 从 UIButton,如何访问它的 UIBarButtonItem?

ios - 如何将文件存储在使用 “documentDirectory” swift 创建的文件夹中

objective-c - UIImagePickerController 不会录制视频

ios - iOS-5 中 UIButton 标题中带下划线的多行

objective-c - 单击单元格内容 View 的按钮后如何访问单元格信息?

ios - 使用 2 个 UIButton 模拟 UISegmentedControl