zoukankan      html  css  js  c++  java
  • Chapter 20 Dynamic Type

    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.

  • 相关阅读:
    [课程设计]Scrum 1.6 多鱼点餐系统开发进度
    [课程设计]Scrum 1.7 多鱼点餐系统开发进度
    [课程设计]Scrum 1.5 多鱼点餐系统开发进度
    [课程设计]Scrum 1.4 多鱼点餐系统开发进度
    [课程设计]Scrum 1.3 多鱼点餐系统开发进度
    [课程设计]Scrum 1.2 Spring 计划&系统流程&DayOne燃尽图
    [课程设计]Scrum 1.1 NABCD模型&产品Backlog
    [课程设计]Scrum团队分工及明确任务1.0 ----多鱼点餐
    学习进度条
    [课程设计]多鱼点餐系统个人总结
  • 原文地址:https://www.cnblogs.com/1oo1/p/4006477.html
Copyright © 2011-2022 走看看