【发布时间】:2016-01-22 05:54:23
【问题描述】:
您好,如果有人可以帮助我,那就太好了!
我需要获取滑动的坐标。我可以从 locationInNode 等获取初始触摸的坐标,但是我们如何获取滑动释放点的坐标?
func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
touched = true
for touch in touches {
location = touch.locationInNode(self)
print(location)
}
}
这就是我获取初始坐标的方式,我也为 touchesMoved 这样做了
override func touchesMoved(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch in touches {
location = touch.locationInNode(self)
print(location)
}
使用此代码,它不会打印触摸时释放的最终坐标。
基本上我想用坐标来锻炼第一次触摸和释放滑动点之间的距离。 谢谢你的帮助!!
【问题讨论】:
-
@Elliott Frisch 如果您能帮助我,那就太好了,因为我刚刚提供了我的问题的更多细节
标签: ios swift sprite-kit uigesturerecognizer swipe-gesture