我想滚动精灵套件节点没有UIScrollView的滚动SpriteNode使用触摸
// 在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行动的结果是非常可怕的,但没有结果也是可怕的
我必须要能够利用滚动内的节点上使用ScrollKit swift版本,touchesBegan中的代码永远不会运行。你有没有UIPanGestureRecognizer的例子? – grape1
@ grape1看看我的编辑,它应该帮助你触摸方法和ScrollKit。使用UIPanGestureRecognizer进行自定义实现将会相当复杂,因为如果它看起来不错(因为一切都将通过SKActions完成,并且您已经看到了这种情况)。就我个人而言,我从来没有遇到过它的外观问题,但我从来不需要创建一个长时间的滚动操作。为此,我会为了简单起见而喜欢ScrollKit。 – MaxKargin
ScrollKit对我所需要的太多了。一个简单的垂直滚动节点,其中包含要选择的字符网格。 – grape1