UITableView / UITableViewCell使用iOS7在iPad上透明背景挑战 [英] UITableView / UITableViewCell challenge with transparent background on iPad with iOS7

查看:109
本文介绍了UITableView / UITableViewCell使用iOS7在iPad上透明背景挑战的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨晚我决定升级到Xcode 5并查看我当前的项目。将我的故事板更新到新的UI后,一切看起来都很棒并且运行良好。由于我有一个通用二进制文件,我决定在iPad上测试一些东西,并注意到我的UITableview中引入了一个新的白色背景,曾经曾经是一个透明/清晰的颜色。这似乎发生在单元级别,而不是表级别。当我在6.1模拟器上运行时,iPad和iPad上的一切都很好看。苹果手机。在iOS7的iPhone上,一切看起来都很好。

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.

我为界面构建器设置的所有内容都与iPhone和iPad相同。 iPad兼容。据我所知,它与这个新的内容视图(它是项目单元格的一个子组)有关,不尊重透明值/设置。

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.

任何想法/想法?

推荐答案

在使用界面构建器浪费了多个小时后,我认为可能存在错误。所以我开始寻找一个程序化的答案。显然,我从这里开始,我本可以节省大量时间。通过添加到方法:

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

通过添加以下一行,我能够解决iPad上的透明度问题:

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

希望这可以帮助其他所有看到ipad的白色背景的人使用表格和iOS7!

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

这篇关于UITableView / UITableViewCell使用iOS7在iPad上透明背景挑战的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆