2

Trying to reproduce behaviour described in this article. Line by line. Everything works well but the last step...

The problem is: I unpause CADisplayLink just before calling UIView.animate and expect the unpaused CADisplayLink to call the attached selector on main thread during animation. It does work, but it starts to call the attached selector with a half a second delay.

Any suggestions?

enter image description here

iWheelBuy
  • 5,470
  • 2
  • 37
  • 71
  • Nope, testing on device. Simulator was just used to make a gif via QuickTime. – iWheelBuy Apr 01 '17 at 14:42
  • Okay, I'll try! Thanks (: – iWheelBuy Apr 01 '17 at 14:50
  • I have found a solution. Replacing RunLoopMode.defaultRunLoopMode with RunLoopMode.commonModes solved the issue. But I am far from understanding the difference between these two modes and why they have such a different impact... ): – iWheelBuy Apr 02 '17 at 03:31
  • 1
    Nevertheless you should answer your own question and, in 2 days, accept your own answer. Well done. – matt Apr 02 '17 at 04:07

1 Answers1

1

It seems that you've chosen a wrong RunLoopMode. With RunLoopMode.commonModes it works like a charm. Look here for a detailed answer.

Community
  • 1
  • 1
Dominion
  • 222
  • 4
  • 11