本文介绍了如何子类UITableViewCell和使用它不清除UILabel背景颜色UITabeViewCell选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用标签在自定义的 UITableViewCell 中通过设置的背景颜色显示指定的颜色(因为这种颜色可能根据来自互联网的输入数据而改变)在viewDidLoad之后,一切正常,但是当这个单元格被选中(突出显示)时,颜色被清除。

In my app, I use a label to display a specified color by set background color in a customized UITableViewCell (because this color maybe changed according incoming data from internet), after viewDidLoad, everything is ok, but when this cell is selected (highlighted) the color is cleared.

搜索后,我发现有人有子类 UITableViewCell 并覆盖 setHighlight 方法以不清除标签背景颜色。我已经尝试过但不幸运。

After searching, I found out that some someone have to subclass UITableViewCell and overwrite setHighlight method to not clear label background color. I have tried but unlucky.

所以有人知道如何做到这一点吗?子类 UITableViewCell 的正确方法,然后在 UITableViewController 中使用它不清除标签背景颜色?请帮助我。

So Does anybody know how to do this? the right way to subclass UITableViewCell, then use it in UITableViewController to not clear label background color? Please help me.

感谢您的任何建议。

推荐答案

最新 UITableViewCell 文档:

此外,请查看 ,了解一些最佳文档。

Also, review the Table View Programming Guide for iOS for some of the best documentation.

这篇关于如何子类UITableViewCell和使用它不清除UILabel背景颜色UITabeViewCell选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:59