我想滾動精靈套件節點沒有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