Objective-c – UITableView / UITableViewCell challenge with transparent background on iPad with iOS7

ios7ipadobjective cuitableview

Last night I decided to upgrade to Xcode 5 and take a look at my current project. After updating my storyboards to the new UI everything looked great and ran fine. Since I have a universal binary, I decided to test things on iPad as well and noticed that a new white background had been introduced into my UITableview where there once used to be a transparent / clear color. This appears to be happening on the cell level, not the table level. When I run things on the 6.1 simulator everything looks fine on iPad & iPhone. And everything looks fine on iPhone for iOS7.

Everything that I have set up for interface builder is identical for iPhone & iPad. From what I can tell it has something to do with this new "content view" (which is a subgroup of the Item Cell) not honoring a transparent value / setting.

Any thoughts / ideas?

Best Answer

After wasting multiple hours with interface builder, I'm thinking that there might be a bug there. So I started to look for a programatic answer. Apparently had I started here I could have saved a ton of time. By adding to the method:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

I was able to solve the transparency issue on iPad by adding this one line:

cell.backgroundColor = [UIColor clearColor];  // Adding this fixes the issue for iPad

Hope this helps everyone else with the white background seen for ipad with tables and iOS7!

Related Topic