JavaEar 专注于收集分享传播有价值的技术资料

Scrolling UIScrollView - block main thread

I have weird problem while UITableView is scrolling I'm not able to invoke any events (touch down button, change layout colour). Funny thing is that when I touches on UISeachBar, the keyboard appears immediately. I realize that main thread has been blocked, however I wonder is there any solution to fix this problem.

1个回答

    最佳答案
  1. With the short description of your problem, I suppose that it is because when you scroll your tableView run loop change from NSDefaultRunLoopMode to NSEventTrackingRunLoopMode (see Run loops)

    To change your UI while scrolling, the solution seems to perform your UI updates on the NSRunLoopCommonModes which includes the two loop mode you target.

    Be prevent that it could make your tableview scrolling clunky.