【发布时间】:2015-09-07 22:29:26
【问题描述】:
我想在没有 uiscrollview 的情况下滚动 sprite kit 中的节点
// 在 touchesMoved 中
let touch: UITouch = touches.first as! UITouch;
let location:CGPoint = touch.locationInNode(self);
let lastPosition = touch.previousLocationInNode(self)
var newLoc = selectNode.position.y + (location.y - lastPosition.y)
// Check if the top part is reached
if(newLoc < selectNodeStart){
newLoc = selectNodeStart
}
if(selectNode.position.y >= selectNodeStart){
// let sk = SKAction.moveToY(newLoc, duration: 0.1)
// selectNode.runAction(sk)
selectNode.position.y = newLoc
}
如果我使用 sk 动作,结果很糟糕,但没有结果也很糟糕
【问题讨论】:
标签: ios swift uiscrollview sprite-kit