I have a UITableView with which works fine and updates fine. I also have a timer that updates each UITableView label and a progress view, when the user is scrolling the table view it stops updating/refreshing the content (labels and progress view) in the UITableView until they are done scrolling.
In addition to the content not updating I have found that when the user is scrolling the entire app hangs. I have two timers and I put print statement in both, but neither prints when the user is scrolling. I have not been able to find a swift or swift 2 solution to this.
This is completely unrelated to Swift whatsoever.
You probably scheduled the NSTimer
using the default method, which results in adding it to a runloop in a way that it's not triggered while scrolling. You need to add it to the main runloop with a NSRunLoopCommonModes
mode instead.
E.g.
let timer = NSTimer(timeInterval: 1.0, target: self, selector: #selector(update), userInfo: nil, repeats: false)
NSRunloop.mainRunLoop().addTimer(timer, forMode: NSRunloopCommonModes)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With