Giter VIP home page Giter VIP logo

bmxcontentsizedemo's Introduction

BMXContentSizeDemo

A simple project to show font information for Dynamic Text in iOS7. The app will display examples for all the UIFontTextStyle values for current selected preferredContentSizeCategory:

NSString *const UIFontTextStyleHeadline;
NSString *const UIFontTextStyleSubheadline;
NSString *const UIFontTextStyleBody;
NSString *const UIFontTextStyleFootnote;
NSString *const UIFontTextStyleCaption1;
NSString *const UIFontTextStyleCaption2;

image

Change text size with slider available in Settings > General > Text Size.

This demo also shows how to listen to Text Size changes. First, register an observer the UIContentSizeCategoryDidChangeNotification notification:

    [[NSNotificationCenter defaultCenter] addObserver: self
                                             selector: @selector(contentSizeCategoryDidChange)
                                                 name: UIContentSizeCategoryDidChangeNotification
                                               object: nil];

Then in the callback method implement the logic to adapt to text size change. Current preferred text size is accessed by UIApplication singleton:

[UIApplication sharedApplication].preferredContentSizeCategory

Sample log output

Below there is the output log produced when running on the iOS Simulator (ProductBuildVersion 11A465). The following data is summarized in this shared spreadsheet.

preferredContentSizeCategory UIContentSizeCategoryExtraSmall
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  14
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  14
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  12
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  11
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  11

preferredContentSizeCategory UIContentSizeCategorySmall
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  15
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  15
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  12
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  11
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  11

preferredContentSizeCategory UIContentSizeCategoryMedium
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  16
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  16
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  12
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  11
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  11

preferredContentSizeCategory UIContentSizeCategoryLarge
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  17
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  17
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  13
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  12
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  11

preferredContentSizeCategory UIContentSizeCategoryExtraLarge
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  18
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  18
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  14
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  13
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  12

preferredContentSizeCategory UIContentSizeCategoryExtraExtraLarge
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  19
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  19
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  15
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  14
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  13

preferredContentSizeCategory UIContentSizeCategoryExtraExtraExtraLarge
UIFontTextStyleHeadline .HelveticaNeueInterface-Bold  20
UIFontTextStyleBody     .HelveticaNeueInterface-MediumP4  20
UIFontTextStyleFootnote .HelveticaNeueInterface-MediumP4  16
UIFontTextStyleCaption1 .HelveticaNeueInterface-MediumP4  15
UIFontTextStyleCaption2 .HelveticaNeueInterface-MediumP4  14

Contact

http://bigatti.it
@mbigatti

bmxcontentsizedemo's People

Contributors

mbigatti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.