Luke Tupper Consulting

Luke Tupper Consulting Blog

iPhone 3.0 UIButton in a UITableViewCell Weirdness

June25

I had a UIButton inside a UITableViewCell and these were being rendered with a black background once I had upgraded the project to iPhone OS 3.0. These table cells were being loaded from their own NIB file.

To stop the black background I needed to set the background of the TableViewCell to white (like you do on most cells after the upgrade), but for the button I also needed to set the UIButton to have the “Clear Context Before Drawing” setting checked.

The background should still be transparent to allow the corners of grouped tables to be shown.

posted under LT Consulting
2 Comments to

“iPhone 3.0 UIButton in a UITableViewCell Weirdness”

  1. On June 25th, 2009 at 8:15 am Sadat Rahman Says:

    @tupps – That is definitely weird. I haven’t come across such behaviour when migrating my iPhone projects to OS 3.0 probably because I use custom rendering for all my UITableView implementations rather than subclassing UITableViewCell. Care to post the before & after screenshots?

  2. On June 25th, 2009 at 11:08 am Luke Tupper Says:

    You wouldn’t see it if everything was done as custom rendering. We use nib files a bit so that non programmers can tweak the design of some of the table cell views. Migrating to OS 3.0 (as in compiling against the API not just running on the phone) turned all of our nib based TableViewCells black, and these button based ones needed an extra step.

Email will not be published

Website example

Your Comment: