-2

I'm trying to create a simple animation in watch kit and i don't find the helpful "completion" that allows to perform a method at the end of the animation. In the code the updateLabel is executed at the same time of the animation.

Here is the code:

var timer = NSTimer.scheduledTimerWithTimeInterval(5, target: self, selector: Selector("someSelector"), userInfo: nil, repeats: false)

func testSequence() {             
    arcImage.setImageNamed("test")
    arcImage.startAnimatingWithImagesInRange(NSMakeRange(1, 30), duration: 3, repeatCount: 1)
    updateLabel() 
}

func updateLabel() {
    label.setText("update")
}
Antonio Viscomi
  • 227
  • 2
  • 5
  • 15

1 Answers1

1

Knowing the duration of the animation, could use a NSTimer to call a method after the duration of the animation is completed.

var nsTimerObject:NSTimer = NSTimer.scheduledTimerWithTimeInterval(timeInSeconds, target: self, selector: "methodToBeCalled", userInfo: nil, repeats: false)
Antonio Viscomi
  • 227
  • 2
  • 5
  • 15