UILongPressGestureRecognizer
长按手势, 它的使用和其它手势没什么区别,我们将学习如何使用它
1. UILongPressGestureRecognizer的创建
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let longPressGestureRecognizer = UILongPressGestureRecognizer(target: self, action: "longPressAction:")
self.view.addGestureRecognizer(longPressGestureRecognizer)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func longPressAction(lon

本文详细介绍了在iOS开发中使用长按手势识别器`UILongPressGestureRecognizer`的创建、工作原理及其完整代码示例。通过分析手势状态,帮助开发者了解如何在长按过程中正确处理事件。
最低0.47元/天 解锁文章
2905

被折叠的 条评论
为什么被折叠?



