Ios 触摸移动停止CADisplayLink动画
在触摸移动中处理动作时,我的CADisplayLink动画暂停。是否可以在后台运行我的CADisplayLink动画? 在moveBigPoints()中,我用手指触摸移动bezier路径的所有选定(大)点。。。当我这样做时,CADisplayLink动画暂停Ios 触摸移动停止CADisplayLink动画,ios,swift,touchesmoved,cadisplaylink,Ios,Swift,Touchesmoved,Cadisplaylink,在触摸移动中处理动作时,我的CADisplayLink动画暂停。是否可以在后台运行我的CADisplayLink动画? 在moveBigPoints()中,我用手指触摸移动bezier路径的所有选定(大)点。。。当我这样做时,CADisplayLink动画暂停 override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?){ if ((animated == false || animati
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)
}
}
override func touchesMoved(touch:Set,带有事件:UIEvent?){
if((动画==假| |动画==真)和&fourFingersIsOn==假){
view.isMultipleTouchEnabled=false
//测试是否存在重大问题:
如果(AllLinesInterActual>=0&(draggedPointIndex!=nil)){
if(bigPointsBuffer.contains(allLines[AllLinesInterActual].linePoints[draggedPointIndex!])){
有两点=正确
}
}
//如果存在重大问题,则采取措施:
如果(drawOrMove.selectedSegmentIndex==1&&doubleTap==false&&thereAreBigPoints==true){
bigPointsHaveMoved=true
接触{
var localPointBuffer=CGPoint()
如果moveBigPointsFirst==false{
localPointBuffer=firstLocalPoint
moveBigPointsFirst=true
}否则{
localPointBuffer=localPointBigPoints
}
localPointBigPoints=touch.location(在:视图中)
var translation=CGPoint()
translation.x=localPointBigPoints.x-localPointBuffer.x
translation.y=localPointBigPoints.y-localPointBuffer.y
moveBigPoints(翻译:翻译)
}
}
你必须做的恰恰相反。如果你必须在Touch中进行大量处理,请在后台移动。非常感谢,但是我如何在Touch中执行我的操作在后台移动+请发布你的TouchsMoved实现这是我的代码,在movingBigPoints()中,我移动所有选定项(大-)用手指触摸点-这会导致CADisplayLink延迟您需要更多代码吗?