【发布时间】:2015-08-04 02:44:14
【问题描述】:
您好,我有一个 swift 应用程序,每次触摸都开始调用一个函数,但是如果用户正在滑动,我不希望 touchesBegan 被调用。我怎样才能避免这种情况?
开始接触:
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
//function call
}
滑动:
var Swipe = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes:"))
Swipe.direction = .Up
//Swipe.cancelsTouchesInView = true did not make a difference
view.addGestureRecognizer(Swipe)
我也不想做触摸结束,因为这增加了我无法拥有的延迟
【问题讨论】:
标签: swift touchesbegan