默认UITableViewCellStyleSubtitle字体大小? [英] Default UITableViewCellStyleSubtitle font size?

查看:124
本文介绍了默认UITableViewCellStyleSubtitle字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

textLabel和detailTextLabel的默认字体大小是什么?

What is the default font size of textLabel and detailTextLabel?

推荐答案

实际字体大小取决于用户在设置中的设置 - >常规 - > TextSize。通常,你不应该使用固定的字体大小,但应该使用类似的东西:

The actual font size depends on the user's settings in Settings -> General -> TextSize. Normally, you shouldn't use a fixed font size, but should use something like:

[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]

显然取决于您的需求。无论如何,如果您使用样式 UITableViewCellStyleSubtitle 创建 UITableViewCell ,则cell.text的字体与

obviously depending on what you need. Anyway, if you create a UITableViewCell with style UITableViewCellStyleSubtitle, then the font of cell.text is the same object as

[UIFont preferredFontForTextStyle: UIFontTextStyleBody]

和cell.detailTextLabel的字体是

and the font of cell.detailTextLabel is the same object as

[UIFont preferredFontForTextStyle: UIFontTextStyleCaption1]. 

使用以Body,Subheadline,Subheadline结尾的常量,您可以获得从大到小的字体脚注,Caption1,Caption2,以便您知道如果您想要稍微更小或更大的文字,可以使用什么。 标题与身体大小相同,但大胆。

You get fonts from largest to smallest using the constants ending in "Body", "Subheadline", "Footnote", "Caption1", "Caption2" so you know what to use if you want slightly smaller or bigger text. "Headline" is same size as "Body" but bold.

最好在运行时创建一个单元格并从中获取字体。

It's probably best to just create a cell at runtime and get the fonts from it.

这篇关于默认UITableViewCellStyleSubtitle字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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