Fastest method for rendering a table view cell?
I'm developing an application that requires me to display many short strings of text in table cells. Currently, I'm using a default table view cell with about 14 UILabels added. Half of these labels contain static text that will not be changed, while the other half contains dynamic data that has to be updated when the table is scrolled.
As my clients are complaining that the table is lagging, I am wondering if there is a more optimized way to display the data, and improve scrolling performance. For example, would the table cells render faster as the table is scrolled if the fixed text is rendered directly o开发者_如何学Cnto the view, instead of being contained in UILabels? What other methods can I use to improve scrolling performance?
Performance issues in table view scrolling can be caused by any number of issues. For example:
- Make sure the
UILabel
s are opaque to avoid blending. (You can select the color blended layers option in the Core Animation instrument to verify this). - Make sure you're recycling table view cells by using
dequeueReusableCellWithIdentifier:
It might be helpful if you could post your implementation of tableView:cellForRowAtIndexPath:
additionally to anshuchimala's answer i would recommend you to remove the static labels and integrate it into a UIImageVie which you use in your tableviewcell as a background image.
Apart from that opacity (as mentioned by anshuchimala) is a big performance-blocker, but also the extensive use ofNSDateFormatter
instances can vastly decrease your performance (especially the instantion of NSDateFormatter instances need a lot of power)
精彩评论