Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView / UITableViewCell challenge with transparent background on iPad with iOS7

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?

like image 875
Causaelity Avatar asked Sep 19 '13 17:09

Causaelity


1 Answers

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!

like image 102
Causaelity Avatar answered Sep 23 '22 12:09

Causaelity