iPhone iOS UILabel如何为UITableView详细文本标签自定义文本颜色? [英] iPhone iOS UILabel how to customize text color for UITableView detail text labels only?

查看:191
本文介绍了iPhone iOS UILabel如何为UITableView详细文本标签自定义文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个接口原型,并使用故事板来做到这一点。原型的一部分涉及将UITabelView的细节UILabel设置为某种颜色。我想避免手动刷新故事板中的每个标签。

I'm working on an interface prototype and am using a storyboard to do so. Part of the prototype involves setting the detail UILabel for UITableView cells to a certain color. I would like to avoid having to manually recolor every label within a storyboard.

我发现我可以使用:

[[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil] 
 setTextColor:[UIColor cyanColor]];

更改tableview单元格中的标签外观。 有没有办法进一步优化此代码以仅应用于详细信息表格标签?目前它会更改UITableViewCell的textLabel和detailTextLabel。

To change the appearance of labels within tableview cells. Is there a way to further refine this code to only apply to detail tableview labels? Currently it changes both textLabel and detailTextLabel of UITableViewCell.

谢谢

推荐答案

您可以通过在细节视图中细分细胞来诱骗这个问题,然后使用

You could trick around this by subclassing the cells in the detail view, then use

[[UILabel appearanceWhenContainedIn:[YOUR_UITableViewCell class], nil] 
 setTextColor:[UIColor other_colr]];

这篇关于iPhone iOS UILabel如何为UITableView详细文本标签自定义文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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