1

In my iOS app, I have a UISlider that is added to my app's window.

var window = UIApplication.shared.keyWindow!
window.insertSubview(slider, at: 0)
window.bringSubview(toFront: slider)

This UISlider gets updated every 0.1 seconds (It's showing the current length of a video and it's updated by a Timer) One of my ViewControllers contains a UIScrollView and when that UIScrollView is scrolled, the UISlider pauses updating. When the user finishes scrolling, the UISlider starts updating normally, again. How can I fix this?

Jacob Cavin
  • 2,169
  • 3
  • 19
  • 47

1 Answers1

1

Problem is that scrolling of UIScrollView causes suspension of NSTimer. So, it's not related with your UISlider.

To fix this, after initialiazation your NSTimer add timer to RunLoop.main for mode RunLoopMode.commonModes

RunLoop.main.add(yourTimer, forMode: RunLoopMode.commonModes)
Robert Dresler
  • 10,580
  • 2
  • 22
  • 40