I'm trying to optimize the UITableViewController for slower devices, and after eliminating many of the reasons why a tableview might be slow, I'm still trying to figure out the last one...
This screenshot is from instruments, showing the most expensive calls, during a time where no call is made to get heightForRowAtIndexPath
or cellForRowAtIndexPath
(scrolling ~10px up and down repeatedly without causing any cell to go out of the table, or get rendered).
Is this normal behavior? Why would the view need relayout if the content of the page is not changing?
答案 0 :(得分:2)
每次滚动时,都会更改contentOffset
。 contentOffset
更新bounds
,特别是origin
。每个bounds
更改标记接收器,以便在下一个更新周期中进行布局。在这种情况下更新frame
浮动子视图,如滚动指示器,表格页眉和页脚,......这是完全正常的行为,你无能为力。别担心,你正在重新显示,而不是重绘。
答案 1 :(得分:1)
我们必须看到一些代码来确定调用该方法的原因,但至少可能是出于以下原因之一:
另外请记住,这只会在需要的时候布局视图。