Restoring animation where it left off when app resumes from background

后端 未结 10 1308
广开言路
广开言路 2020-11-28 18:57

I have an endlessly looping CABasicAnimation of a repeating image tile in my view:

a = [CABasicAnimation animationWithKeyPath:@\"position\"];
a         


        
10条回答
  •  独厮守ぢ
    2020-11-28 19:21

    I was recognizing the gesture state like so:

    // Perform action depending on the state
    switch gesture.state {
    case .changed:
        // Some action
    case .ended:
        // Another action
    
    // Ignore any other state
    default:
        break
    }
    

    All I needed to do was change the .ended case to .ended, .cancelled.

提交回复
热议问题