I have a UITableView where we want to just put a colored square. Depending on the data in the UITableViewCell, the UIView changes its background color. That’s the way it currently is. To me, it seems better to just have a UIImageView and have a .png image for the different color squares, and load the correct one per cell depending on the data in the UITableViewCell. I’m not sure which method is better, or if there is an even better method I do not know of. Any thoughts? Thanks.
Share
Having worked with images contained in table cells, I have to believe that simply using a UIView and setting it’s background color to whatever you need is going to be far faster.
Even with local images (those in your app bundle), think of all the extra work you’d be incurring to create a UIImage and then set the UIImageView’s image property?
In my case, on two different projects, I had to load images off the ‘net into table cells. Quite slow, so we did it in the background, which had it’s own challenges and special conditions to deal with. This would be overkill for what you describe though.
I’d go with UIView’s and background colors. Of course, you could try it yourself both ways and see how it works for you. 🙂 Remember to test on a real device, because it’s easy to be lulled into a sense of “everything is GREAT!” when you watch your app scream on the simulator! 🙂