Chapter 20 Dynamic Type

1. The Dynamic Type system is centered around text styles. 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. Below shows the six different text styles:

UIFontTextStyleHeadline

UIFontTextStyleSubheadline

UIFontTextStyleBody

UIFontTextStyleFootnote

UIFontTextStyleCaption1

UIFontTextStyleCaption2

2. UIApplication exposes the text size that user selected through its preferredContentSizeCategory property. the method will return a contestant NSString with the name of the content size category, which will be one of the following values:

UIContentSizeCategoryExtraSmall

UIContentSizeCategorySmall

UIContentSizeCategoryMedium

UIContentSizeCategoryLarge (Default)

UIContentSizeCategoryExtraLarge

UIContentSizeCategoryExtraExtraLarge

UIContentSizeCategoryExtraExtraExtraLarge

-(void)updateTableViewForDynamicTypeSize

{

static NSDictionary *cellHeightDictinary;

if(!cellHeightDictinary)

{

cellHeightDictinary = @{UIContentSizeCategoryExtraSmall : @44,

UIContentSizeCategorySmall : @44,

UIContentSizeCategoryMedium : @44,

UIContentSizeCategoryLarge : @50,

UIContentSizeCategoryExtraLarge : @55,

UIContentSizeCategoryExtraExtraLarge : @65,

UIContentSizeCategoryExtraExtraExtraLarge : @75};

}

NSString *userSize = [[UIApplication sharedApplication] preferredContentSizeCategory];

NSNumber *cellHeight = cellHeightDictinary[userSize];

[self.tableView setRowHeight:cellHeight.floatValue];

[self.tableView reloadData];

}

3. awakeFromNib method is called on an object after it has been unarchived from a NIB file, and is a great place to do any additional UI work that cannot be done within the XIB file.

时间: 2024-08-08 05:38:40

Chapter 20 Dynamic Type的相关文章

Chapter 13 - Dynamic type and DLR

The content and code of this article is referenced from book Pro C#5.0 and the .NET 4.5 Framework by Apress. The intention of the writing is to review the konwledge and gain better understanding of the .net framework.    1. The role of C# dynamic key

Big Nerd iOS Programming 第20章 Dynamic Type 动态类型

Dynamic Type 动态类型 1.比如字体.使用动态的用户自定义的系统字体. -(void)updateFonts    {        UIFont *font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody];        self.nameLabel.font = font;        self.dataLabel.font = font;    } 2.注册,获取修改通知    当用户修改了字体或者系统设置,会

C语言 结构体指针赋值 incompatible types when assigning to type 'char[20]' from type 'char *'

strcpy(pstudent->name, "guo zhao wei "); 为什么错误,该怎么写,(红色行) 追问 为什么不能直接赋值啊, 追答 用char nnnn[20]定义的,用strcpy 用char *ppp定义的,用=来赋值 C语言 结构体指针赋值 incompatible types when assigning to type 'char[20]' from type 'char *'

iOS Programming Dynamic Type 1

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 为了优化

可变cell,自适应cell,理解iOS 8中的Self Sizing Cells和Dynamic Type

在iOS 8中,苹果引入了UITableView的一项新功能--Self Sizing Cells,对于不少开发者来说这是新SDK中一项非常有用的新功能.在iOS 8之前,如果想在表视图中展示可变高度的动态内容时,你需要手动计算行高,而Self Sizing Cells为展示动态内容提供了一个解决方案.以下是你使用Self Sizing Cells时需要注意的事项: 1.为原型单元格定义Auto Layout约束 2.指定表视图的estimatedRowHeight 3.将表视图的rowHeig

理解iOS 8中的Self Sizing Cells和Dynamic Type

本文转载至 http://www.cocoachina.com/ios/20140922/9717.html iOS开发Dynamic TypeSelf Sizing 在iOS 8中,苹果引入了UITableView的一项新功能--Self Sizing Cells,对于不少开发者来说这是新SDK中一项非常有用的新功能.在iOS 8之前,如果想在表视图中展示可变高度的动态内容时,你需要手动计算行高,而Self Sizing Cells为展示动态内容提供了一个解决方案.以下是你使用Self Siz

零元学Expression Blend 4 – Chapter 20 以实作案例学习Childwindow

原文:零元学Expression Blend 4 – Chapter 20 以实作案例学习Childwindow 本章将教大家如何运用Blend 4内建的假视窗原件-「ChildWindow」 ChildWindow常常运用在使用者登入.特殊警告或是其他强调式的需求功能 ? 本章将教大家如何运用Blend 4内建的假视窗-「ChildWindow」 ChildWindow常常运用在使用者登入.特殊警告或是其他强调式的需求功能 ? 就是要让不会的新手都看的懂! ? 最近公司需要我做一个可以让客户点

Working with the Dynamic Type in C#

Working with the Dynamic Type in C# https://www.red-gate.com/simple-talk/dotnet/c-programming/working-with-the-dynamic-type-in-c/?utm_source=simpletalkdotnet&utm_medium=pubemail&utm_content=20181127-slota1&utm_term=simpletalkmain by Camilo Rey

Chapter 20 磁场对电流的作用

总结 知识点 20.1 磁场对运动电荷的作用 洛伦兹力(磁场力): 霍尔效应: 20.2 磁场对载流导线的作用 安培定律: 计算公式: 应用: 20.3 均匀磁场对载流线圈的作用 力偶(两个大小相等,方向相反,但不在同一直线上的力):力臂: 力偶矩=力偶*力臂: 磁矩:Pm 磁力做功: 载流导线在磁场中运动时磁力所作的功 载流线圈在磁场中转动时磁场力的功 来自为知笔记(Wiz)