統計情報(30日間)


最新情報をツイート


人気の投稿

[iOS7] Text Kit チュートリアル

このエントリーをはてなブックマークに追加

新しく導入された Dynamic type から始まり、レイアウトのカスタマイズ、動的フォーマッティングなどテキストビューの凝った表現を解説する実用的なチュートリアル。自分でテキスト表現をカスタマイズしたいときには参考になる。



UITextView.textContainer.exclusionPaths を利用したテキストの回り込み配置

NSTextStorageをサブクラス化して、動的に文字をフォーマッティング

テキスト周りのクラス相関図

なお iOS6と7でテキスト周りのシステム構成が変わったとのこと。

iOS6

iOS7

String Drawing が排除され、新しく TextKitが導入された。これがDynamic Fontなどを実現しているようだ。またWebKitがUIWebView専用に。

- - - - -
参考情報:Introducing Text Kit
※要AppleDeveloperアカウント


What's New in iOSより
Text Kit
Text Kit is a full-featured set of UIKit classes for managing text and fine typography. Text Kit can lay out styled text into paragraphs, columns, and pages; it easily flows text around arbitrary regions such as graphics; and it manages multiple fonts. Text Kit is integrated with all UIKit text-based controls to enable apps to create, edit, display, and store text more easily—and with less code than was previously possible in iOS.

Text Kit comprises new classes and extensions to existing classes, including the following:

The NSAttributedString class has been extended to support new attributes.
The NSLayoutManager class generates glyphs and lays out text.
The NSTextContainer class defines a region where text is laid out.
The NSTextStorage class defines the fundamental interface for managing text-based content.
For more information about Text Kit, see Text Programming Guide for iOS.

Leave a Reply