【发布时间】:2016-01-26 09:46:25
【问题描述】:
我正在寻找touchesEnded 的最终位置。我的touchesBegan 代码如下所示:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first {
touchStart = touch.locationInNode(self)
print("touchStart_1: \(touchStart)")
}
}
印刷品给了我位置。
在touchesEnded,我有以下内容:
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
if let touch = touches.first, start = touchStart {
print("touchStart_2: \(touchStart)")
let location = touch.locationInNode(self)
print("touchEnded: \(location)")
}
}
这些打印都没有返回任何内容。作为附加信息,我也在其他地方使用UISwipeGestureRecognizer,但我知道手势识别器独立于触摸工作。知道发生了什么吗?
【问题讨论】:
标签: location swift2 uigesturerecognizer touchesbegan touchesended