Table Cells UILabel setFont的外观代理的替代方法(Alternatives to appearance proxy for Table Cells' UILabel

编程入门 行业动态 更新时间:2024-10-27 02:20:30
Table Cells UILabel setFont的外观代理的替代方法(Alternatives to appearance proxy for Table Cells' UILabel setFont)

我很高兴能够在我的iOS5应用程序中使用外观代理来自定义系统范围内的NavigationController UI元素,但是:

我的应用程序中有很多嵌套表格,其中我希望能够在所有表格单元格中更改字体。 它们主要是静态创建的。 我已经将一些单元格生成放入类中,从数组中读取,但主要问题在于我在Interface Builder中放入了大量内容部分。 IB似乎没有用于批量字体设置的选项。

我想知道是否有人可以帮我找到一种方法来设置所有的UITableCell字体?

也许是这样的:

[[UILabel appearance] setFont:[UIFont fontWithName:@"Times" size:17.00];

I'm loving being able to use an appearance proxy in my iOS5 app to customise the NavigationController UI elements system-wide, however:

I have a lot of nested tables in my app, of which I'd love to be able to change the font across all table cells. They are mainly statically created. I've put some cell generation inside of a class, being read from an array, but the main issue lies with a large contents section I've tabled in Interface Builder. IB doesn't seem to have the option for mass-font setting.

I was wondering if anyone could help me find a way to set all the UITableCell fonts in one go?

Perhaps something like:

[[UILabel appearance] setFont:[UIFont fontWithName:@"Times" size:17.00];

最满意答案

您可以使用appearanceWhenContainedIn:来缩小要为其设置外观的UIViews的范围。

在你的例子中,尝试:

[[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil] setFont:[UIFont fontWithName:@"Times" size:17.00]];

You can use appearanceWhenContainedIn: to narrow down which UIViews you'd like to set the appearance for.

In your example, try:

[[UILabel appearanceWhenContainedIn:[UITableViewCell class], nil] setFont:[UIFont fontWithName:@"Times" size:17.00]];

更多推荐

本文发布于:2023-07-16 12:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128526.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:外观   方法   UILabel   Table   Cells

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!