Using UIKit

- Using TextKit is as easy as using any of the…text based controls included with iOS.…Here I've opened a working copy of TextKit-Demo…in Xcode and you can see that there's not much code here,…I have a story board, I have a text view,…and I have a couple of labels.…The status label and the text view are brought out here…in the view controller.…This is really a very simple view controller.…You notice that I have viewDid layout subviews…and I'm calling a knitext from within…viewDid layout subviews.…

Some of this doesn't work if you call it from…viewDid load because the text view hasn't yet…been laid out and so it's kind of important to do…a lot of this from viewDid layout subviews…rather than viewDid load.…Here I set a font for the text view to Courier…and I'm using this preferred font for text style…UI font text style body.…That gives us the standard body type text style…for the status label.…This, because there's so much text here,…I need to scroll to the top because right after layout…it will have it scrolled all the way down here…

Resume Transcript Auto-Scroll

Author

Released

11/23/2015

Get a quick introduction to Text Kit, the Apple API for formatting and managing text in iOS 9 applications. Using Text Kit, developers can enhance the display of text in their apps with fonts, styles, spacing, and even ligatures. In these short tutorials, Bill Weinman explains what Text Kit is and provides examples that show how to use Text Kit in iOS 9 applications: to support accessibility with dynamic type, flow text around images, or manage font resources with font descriptors.