UIView and UITableView, reloadData weird latency

后端 未结 2 2140
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 18:22

I have something weird with the repaint of my view controller. The view controller contains an UITableView and a spinner.

I have an updateFeed function

2条回答
  •  暖寄归人
    2021-02-08 19:01

    I'm not sure what's causing your delay, but it smells like it could be a threading issue. Many UIKit classes aren't thread safe. As a general rule, you should try to make sure that all of your UI interaction happens on the main thread. In the code you originally posted, it looked like you were calling reloadData from your background thread, which seems risky. It's not clear to me which thread it's being called from now that you've changed your code.

    Go through your doUpdate code path and make sure that any calls back to your delegate that could lead to a UI update are being done via performSelectorOnMainThread:.

提交回复
热议问题