views:

14

answers:

2

Hi,

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 onto the view, instead of being contained in UILabels? What other methods can I use to improve scrolling performance?

+1  A: 

Performance issues in table view scrolling can be caused by any number of issues. For example:

  • Make sure the UILabels 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:

anshuchimala
Yes, I do have transparent UILabels. Will changing the UILabels to opaque improve performance by a lot? (And yes, I am already reusing uitableviewcells already.)
futureelite7
A: 

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)

samsam
Hi, unfortunately, I need to localize the strings, which means I cannot simply include them into static images. Besides, won't images for each cell take up more space?
futureelite7
Images will be cached, iOS would keep only one instance of the image in memory (as far as i know :D ) . you could make localized versions of your background-image though.
samsam