【发布时间】:2014-10-23 06:44:30
【问题描述】:
我正在为单元格创建自定义选择样式。我删除了所有背景颜色并使它们透明,然后我更改了标签的颜色和其他我需要的东西。 The problem is that sometimes in iOS 8 with iPhone 5S I get black background when cell is selected.我有来自真实设备的这些信息,我有屏幕。在其他设备上看起来它正在工作(但我不确定)。问题是,当我尝试在模拟器中查看它时,它在多次尝试中仅显示了几次此问题(类似于 20 次中的一次)。
问题看起来与从具有清晰颜色的图像中设置 selectedBackgroundView 一致。我一直在寻找其他地方,我认为问题不在其他地方。 clearColor 的图像可能有问题吗?你会如何解决它?如何在没有真机的情况下进行测试?
// Make default subviews transparent in case someone decides to use them.
self.textLabel.backgroundColor = [UIColor clearColor];
self.detailTextLabel.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
self.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageWithColor:[UIColor clearColor]]];
self.selectedBackgroundView.tintColor = [UIColor clearColor];
编辑:我再次阅读了我的帖子,我没有说我有 iPhone 5 (iOS 8),我在其中测试了这个应用程序,它看起来不错,我知道在 iPhone 4 中它也可以正常工作。我可以说哪些设备在工作,哪些不工作。这三个我都知道。
【问题讨论】:
-
您是在故事板中工作还是只在代码中工作? 只有一个单元格吗?
-
只有一个单元格类(MenuCell)。上面的代码是在 awakeFromNib 函数中设置的,在 Storyboard 中我只是设置了视图和插座。
标签: ios objective-c uiimageview ios8 transparency