I have a UITableView that’s experiencing performance problems on older phones. The table cells have dynamic content pulled from the web, so their heights all vary. Right now I’m using background images for the cells that stretch depending on the height of the content.
On the iPhone 5 and 4S, the table scrolling performance is perfectly smooth, but on an iPhone 4 it’s a little choppy.
I believe the issue is the background image. Right now, the image has alpha transparency to add a shadow to each cell. I read that images with transparencies can cause performance issues in UITableViews, but this was from a post back in 2008, when iPhones weren’t as fast overall. Could the alpha transparency be causing the issue?
Also, would I get better performance if I programmatically drew the cell backgrounds instead of using a background image? How do apps like Facebook and Foursquare, which have custom dynamic cells, draw the cells’ background?
Best performance is achieved if you draw all the cell content yourself, even substituting common UI elements such as
UILabelandUIImageView.Many successful apps in the App Store use this technique. And, yes, avoid transparent views whenever you can if performance is a issue.