UIKit.NSTextStorage Class
A subclass of Foundation.NSMutableAttributedString that supports Core Text layout management.

See Also: NSTextStorage Members

Syntax

[Foundation.Register("NSTextStorage", true)]
[ObjCRuntime.Availability(Introduced=ObjCRuntime.Platform.iOS_7_0)]
public class NSTextStorage : Foundation.NSMutableAttributedString

Remarks

iOS 7 introduced "Text Kit," a broad set of APIs and modifications of existing classes, built on CoreText, that greatly expands the typographical flexibility of iOS.

An UIKit.NSTextStorage object holds the text that is to be displayed. As with Foundation.NSMutableAttributedString, application developers can manipulate text styles using Foundation.NSMutableAttributedString.AddAttribute or Foundation.NSMutableAttributedString.AddAttributes. The key addition to UIKit.NSTextStorage is that it maintains references to one or more UIKit.NSLayoutManagers (NSTextStorage.LayoutManagers) , which are responsible for converting text characters into glyphs and laying them out in accordance with the UIKit.NSLayoutManagers' associated UIKit.UITextView and UIKit.NSTextContainer objects.

If you subclass NSTextStorage, you must override four methods. Two from NSAttributedString (Foundation.NSAttributedString.LowLevelValue and Foundation.NSAttributedString.LowLevelGetAttributes) and two from NSMutableAttributedString (Foundation.NSMutable.AttributedString.LowLevelSetAttributes and Foundation.NSMutableAttributedString.Replace()).

The reason why you must override the low-level methods is because NSTextStorage is a very chatty interface that likes to call those methods up to thousands of times for each character that the user enters. So it important to use the low-level interface. You can review some of Xamarin's samples to see how to implement those if you have questions on how to do this.

Since NSTextStorage is a very chatty API,

Related content

Requirements

Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0