touchesMoved停止CADisplayLink动画

时间:2017-06-02 22:03:15

标签: ios swift touchesmoved cadisplaylink

当我在touchesMoved中处理动作时,我的CADisplayLink动画暂停了。有可能在后台运行我的CADisplayLink动画吗? 在moveBigPoints()中,我用手指触摸移动贝塞尔曲线路径的所有选定(大)点...当我这样做时,CADisplayLink动画暂停......

override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?){

    if ((animated == false || animationIsPaused == true) && fourFingersIsOn == false) {
        view.isMultipleTouchEnabled = false

        //test if there are bigPoints:
        if(allLinesCounterActual >= 0 &&  (draggedPointIndex != nil)) {
                if(bigPointsBuffer.contains(allLines[allLinesCounterActual].linePoints[draggedPointIndex!])) {
                    thereAreBigPoints = true
                }

        }
        //action if there are bigPoints:
        if(drawOrMove.selectedSegmentIndex == 1 && doubleTap == false && thereAreBigPoints == true) {

            bigPointsHaveMoved = true

            for touch in touches {
                var localPointBuffer = CGPoint()
                if moveBigPointsFirst == false {
                    localPointBuffer = firstLocalPoint
                    moveBigPointsFirst = true
                } else {
                    localPointBuffer = localPointBigPoints
                }
                localPointBigPoints = touch.location(in: view)
                var translation = CGPoint()
                translation.x = localPointBigPoints.x - localPointBuffer.x
                translation.y = localPointBigPoints.y - localPointBuffer.y
                moveBigPoints(translation: translation)
            }
        }

0 个答案:

没有答案