在我的 viewdidload() 中,我像这样初始化了 longpressgesturerecognizer
override func viewDidLoad() {
super.viewDidLoad()
let lpgr = UILongPressGestureRecognizer(target: self, action: "action:")
lpgr.minimumPressDuration = 2.0
Capture.addGestureRecognizer(lpgr)
// Do any additional setup after loading the view.
}
然后我尝试运行这个功能,它后来成为相机的录制按钮
func action(gestureRecognizer:UIGestureRecognizer) {
print("pressed")
}
@IBOutlet weak var Capture: UIProgressView!