你的位置:首页 > 软件开发 > 操作系统 > iOS Programming Dynamic Type 1

iOS Programming Dynamic Type 1

发布时间:2015-05-21 02:02:00
iOS Programming Dynamic Type 1  Dynamic Type is a technology introduced in iOS 7 that helps realize this goal by providing specifical ...

iOS Programming Dynamic Type 1 

Dynamic Type is a technology introduced in iOS 7 that helps realize this goal by providing specifically designed text styles that are optimized for legibility.

Dynamic Type 是从iOS7引入的技术来帮助实现这个目标通过提供专门设计的text styles 为了优化清晰度。

The Dynamic Type system is centered around text styles.

Dynamic Type系统是以text style系统为中心的。

When a font is requested for a given text style, the system will use the user's preferred text size in association with the text style to return an appropriately configured font.

当字体请求一个给定的文本类型,系统就会使用用户喜欢的text size 与相关的text style 返回一个恰当的配置好的字体。

1 Using Preferred Fonts 使用偏好字体

Implementing Dynamic Type is straightforward. At its most basic level, you get a UIFont for a specific text style and then apply that font to something that displays text, such as a UILabel.

你得到一个指定的text style 的UIFont,并实现那个font到一些东西,比如说UILabel到一些事情上。

You are going to need to update some attributes of the labels programmatically soon, so add outlets to each of the labels to the class extension in BNRDetailViewController.m.

 

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (weak, nonatomic) IBOutlet UILabel *serialNumberLabel;

@property (weak, nonatomic) IBOutlet UILabel *valueLabel;

Now that there is an outlet to each of the labels, add a method that sets the font for each to use the preferred Body style.

现在每个label都有一个outlet,添加一个方法为每个label 设置字体来使用perfered 字体格式。

- (void)updateFonts

{

原标题:iOS Programming Dynamic Type 1

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。