Content Specific Highlighting
One of the most interesting features of TextKit is Content Specific Highlighting. Before iOS 7, using CoreText to modify the appearance of specific strings inside of a text view was elaborate and cumbersome. iOS 7 brings many improvements to rich text rendering and definition.
To work with custom attributed text, a subclass of an NSTextStorage
is created, called ICFDynamicTextStorage
in the sample project. This approach will allow the developer to set tokens for different attributed strings to be rendered per string encountered. A classwide NSMutableAttributedString
is created, which will hold on to all the associated attributes for the displayed text.
- (id)init{ self = [super
Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.