【发布时间】:2015-08-10 21:05:49
【问题描述】:
由于 Xcode 未从 Main.storyboard 提供,我如何以编程方式添加 UIView touchbegin 操作或 touchend 操作?
【问题讨论】:
-
那个是按钮,OP想为UIView添加事件
-
使用
UILongPressGestureRecognizer并将minimumPressDuration设置为零。 See this answer. 它不需要继承或覆盖任何东西。
标签: ios swift uiview uiviewcontroller