gpt4 book ai didi

ios - UITableViewStyleGrouped 样式的 UITableView Cell 的默认背景颜色是什么

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:54:27 29 4
gpt4 key购买 nike

我需要在我的 UITableView 中设置单元格的背景颜色。那很好用。然后,后来,我想把它恢复到原来的颜色。现在,在 iOS4 下颜色是白色,在 iOS 5 下颜色是#f7f7f7(见 Different cell bg color depending on iOS version (4.0 to 5.0) )

现在,我总是可以询问 viewDidLoad 中的单元格它的背景颜色是什么,但这似乎是一个 hack。如果 Apple 已经安排好电话,我会很高兴。由于它依赖于 iOS 版本,因此它不会是静态 UIColor 方法。

那么,有没有一种更简洁的方法来获取这种颜色,或者我只需要在对话框首次出现时询问?

有趣的是,我无法以编程方式获取背景颜色!如果我这样做:

backgroundCellColor = usernameCell.backgroundColor; 
NSLog(@"*** backgroundcolor is: %@",backgroundCellColor);

然后,当我查看我的控制台时,我会看到:

2011-12-06 15:11:08.686 Ferret[47035:f803] *** backgroundcolor is: (null)

谢谢!

最佳答案

我认为索取原件并不是一种黑客行为。一方面,它允许 Apple 按照他们认为合适的方式更改外观。它还允许您自定义 nib 文件中的内容。

关于ios - UITableViewStyleGrouped 样式的 UITableView Cell 的默认背景颜色是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8405644/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com