Share via


NSLayoutManager Class

Definition

Responsible for layout of text stored in a NSTextStorage object.

[Foundation.Register("NSLayoutManager", true)]
public class NSLayoutManager : Foundation.NSObject, Foundation.INSSecureCoding, IDisposable
[<Foundation.Register("NSLayoutManager", true)>]
type NSLayoutManager = class
    inherit NSObject
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSSecureCoding
Inheritance
NSLayoutManager
Attributes
Implements

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.

The TextStorage property holds a reference to a NSTextStorage object, that holds a potentially large amount of styled text. The TextContainers property holds an ordered array of NSTextContainer objects in which it lays out text. The NSTextContainers, in turn, hold references to UITextView objects, which actually display the text.

Constructors

Name Description
NSLayoutManager()

Creates a new NSLayoutManager with default values.

NSLayoutManager(NativeHandle)

A constructor used when creating managed representations of unmanaged objects. Called by the runtime.

NSLayoutManager(NSCoder)

A constructor that initializes the object from the data stored in the unarchiver object.

NSLayoutManager(NSObjectFlag)

Constructor to call on derived classes to skip initialization and merely allocate the object.

Properties

Name Description
AccessibilityAttributedUserInputLabels (Inherited from NSObject)
AccessibilityRespondsToUserInteraction (Inherited from NSObject)
AccessibilityTextualContext (Inherited from NSObject)
AccessibilityUserInputLabels (Inherited from NSObject)
AllowsNonContiguousLayout

Whether layout can be done for a portion of the document without laying-out being recalculated from the beginning.

Class (Inherited from NSObject)
ClassHandle

The Objective-C class handle for this class.

DebugDescription (Inherited from NSObject)
Delegate

An instance of the UIKit.INSLayoutManagerDelegate model class which acts as the class delegate.

Description (Inherited from NSObject)
ExtraLineFragmentRect

The CGRect needed for the insertion point.

ExtraLineFragmentTextContainer

The NSTextContainer containing the ExtraLineFragmentRect.

ExtraLineFragmentUsedRect

The rectangle enclosing the insertion point.

FirstUnlaidCharacterIndex

The index of the first character that has not been laid out.

FirstUnlaidGlyphIndex

The index of the first glyph that has not been laid out.

Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
HasNonContiguousLayout

Whether the NSLayoutManager currently contains any areas of noncontiguous layout.

HyphenationFactor

The hyphenation threshold.

IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
LimitsLayoutForSuspiciousContents
NumberOfGlyphs

The number of glyphs in the NSLayoutManager.

RetainCount (Inherited from NSObject)
Self (Inherited from NSObject)
ShowsControlCharacters

Specifies whether control characters should be shown or not.

ShowsInvisibleCharacters

Specifies whether normally-invisible characters such as whitespace should have visible glyphs.

Superclass (Inherited from NSObject)
SuperHandle

Handle used to represent the methods in the base class for this NSObject.

(Inherited from NSObject)
TextContainers

An array of NSTextContainers that model the geometric layout of a document.

TextStorage
UsesDefaultHyphenation
UsesFontLeading

Whether the NSLayoutManager should use the leading provided in the font.

WeakDelegate
Zone (Inherited from NSObject)

Methods

Name Description
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddTextContainer(NSTextContainer)

Appends a NSTextContainer to the TextContainers property.

AwakeFromNib() (Inherited from NSObject)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
ConformsToProtocol(NativeHandle) (Inherited from NSObject)
Copy() (Inherited from NSObject)
DangerousAutorelease()

Calls the 'autorelease' selector on this object.

(Inherited from NSObject)
DangerousRelease()

Calls the 'release' selector on this object.

(Inherited from NSObject)
DangerousRetain()

Calls the 'retain' selector on this object.

(Inherited from NSObject)
DidChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String) (Inherited from NSObject)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)
DoesNotRecognizeSelector(Selector) (Inherited from NSObject)
DrawBackground(NSRange, CGPoint)

Draws background marks for the given glyph range.

DrawGlyphs(NSRange, CGPoint)

Draws the specified glyph range.

DrawsOutsideLineFragmentForGlyph(UIntPtr)

Returns true if the specified glyph draws outside of its line fragment rectangle.

DrawStrikethrough(NSRange, NSUnderlineStyle, NFloat, CGRect, NSRange, CGPoint)

Draws a strikethrough line through the glyphs in glyphRange.

DrawUnderline(NSRange, NSUnderlineStyle, NFloat, CGRect, NSRange, CGPoint)

Underlines the glyphs in glyphRange.

EncodeTo(NSCoder)

Encodes the state of the object using the provided encoder.

EnsureGlyphsForCharacterRange(NSRange)

Forces the NSLayoutManager to generate glyphs for the specified characters, if it has not already done so.

EnsureGlyphsForGlyphRange(NSRange)

Forces the NSLayoutManager to generate glyphs for the specified glyph range, if it has not already done so.

EnsureLayoutForBoundingRect(CGRect, NSTextContainer)

Forces the layout manager to perform layout on bounds within container.

EnsureLayoutForCharacterRange(NSRange)

Forces the NSLayoutManager to layout the specified characters, if it has not already done so.

EnsureLayoutForGlyphRange(NSRange)

Forces the NSLayoutManager to layout the specified glyphs, if it has not already done so.

EnsureLayoutForTextContainer(NSTextContainer)

Forces the NSLayoutManager to layout the specified NSTextContainer, if it has not already done so.

EnumerateEnclosingRects(NSRange, NSRange, NSTextContainer, NSTextLayoutEnumerateEnclosingRects)

Enumerates the enclosing rectangles for the specified glyph range.

EnumerateLineFragments(NSRange, NSTextLayoutEnumerateLineFragments)

Enumerate the line fragments intersecting with the specified glyph range.|Enumerate the line fragments intersecting with the specified glyph rane.

Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
FillBackground(IntPtr, UIntPtr, NSRange, UIColor)
GetAttachmentSizeForGlyph(UIntPtr)

The size of the attachment cell associated with the glyph at the specified index

GetBoundingRect(NSRange, NSTextContainer)

The bounding rectangle, in container coordinates, for the glyphs in the specified range.

GetCharacterIndex(CGPoint, NSTextContainer, IntPtr)
GetCharacterIndex(CGPoint, NSTextContainer, NFloat)
GetCharacterIndex(CGPoint, NSTextContainer)
GetCharacterIndex(UIntPtr)

The index of the first character associated with the glyph at the specified index.

GetCharacterRange(NSRange, IntPtr)
GetCharacterRange(NSRange, NSRange)
GetCharacterRange(NSRange)
GetDictionaryOfValuesFromKeys(NSString[]) (Inherited from NSObject)
GetFirstUnlaidCharacterIndex(UIntPtr, UIntPtr)

The indices of the first character and glyph that are not laid out.

GetFractionOfDistanceThroughGlyph(CGPoint, NSTextContainer)

Developers should call GetGlyphIndex(CGPoint, NSTextContainer) rather than this primitive function.

GetGlyph(UIntPtr, Boolean)

Retrieves the glyph as glyphIndex, setting isValidIndex to true if the index is valid.

GetGlyph(UIntPtr)

Retrieves the glyph at glyphIndex.

GetGlyphIndex(CGPoint, NSTextContainer, NFloat)

The glyph index for the glyph at point, in the container object's coordinate system.

GetGlyphIndex(CGPoint, NSTextContainer)

Developers should call GetGlyphIndex(CGPoint, NSTextContainer, NFloat) rather than this primitive method.

GetGlyphIndex(UIntPtr)

The glyph index for the character at the specified index.

GetGlyphRange(NSRange, IntPtr)
GetGlyphRange(NSRange, NSRange)
GetGlyphRange(NSRange)
GetGlyphRange(NSTextContainer)

The range of glyph indices contained in the specified NSTextContainer.

GetGlyphRangeForBoundingRect(CGRect, NSTextContainer)

Returns the range of glyph indices that are at least partially in the bounds.

GetGlyphRangeForBoundingRectWithoutAdditionalLayout(CGRect, NSTextContainer)

Returns the range of glyph indices that are at least partially in the bounds without glyph production or layout.

GetGlyphs(NSRange, Int16[], NSGlyphProperty[], UIntPtr[], Byte[])

Fills glyphBuffer with the glyphs in glyphRange.

GetGlyphs(NSRange, IntPtr, IntPtr, IntPtr, IntPtr)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetLineFragmentInsertionPoints(UIntPtr, Boolean, Boolean, IntPtr, IntPtr)
GetLineFragmentInsertionPoints(UIntPtr, Boolean, Boolean, NFloat[], IntPtr[])

Fills positions and charIndexes with the positions and indices of the insertion points for a line fragment.

GetLineFragmentRect(UIntPtr, Boolean)
GetLineFragmentRect(UIntPtr, IntPtr, Boolean)
GetLineFragmentRect(UIntPtr, IntPtr)
GetLineFragmentRect(UIntPtr, NSRange, Boolean)

Gets the line fragment CGRect containing the glyph at glyphIndex, with the option of not triggering layout.

GetLineFragmentRect(UIntPtr, NSRange)
GetLineFragmentRect(UIntPtr)
GetLineFragmentUsedRect(UIntPtr, Boolean)
GetLineFragmentUsedRect(UIntPtr, IntPtr, Boolean)
GetLineFragmentUsedRect(UIntPtr, IntPtr)
GetLineFragmentUsedRect(UIntPtr, NSRange, Boolean)

Gets the usage CGRect containing the glyph at glyphIndex, with the option of not triggering layout.

GetLineFragmentUsedRect(UIntPtr, NSRange)
GetLineFragmentUsedRect(UIntPtr)
GetLocationForGlyph(UIntPtr)

The ___location of the glyph at the specified index, relative to the containing line fragment's origin.

GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetProperty(UIntPtr)
GetRangeOfNominallySpacedGlyphsContainingIndex(UIntPtr)

The largest range of glyphs surrounding the glyph at the specified index that can be displayed using only advancement, not pairwise kerning or other adjustments.

GetTextContainer(UIntPtr, Boolean)
GetTextContainer(UIntPtr, IntPtr, Boolean)
GetTextContainer(UIntPtr, IntPtr)
GetTextContainer(UIntPtr, NSRange, Boolean)

Gets the NSTextContainer containing the glyph at glyphIndex, with the option of not triggering layout.

GetTextContainer(UIntPtr, NSRange)
GetTextContainer(UIntPtr)
GetTruncatedGlyphRangeInLineFragment(UIntPtr)
GetUsedRect(NSTextContainer)

The bounding rectangle in the NSTextContainer's coordinates of the laid out glyphs in the NSTextContainer.

GlyphAtIndex(UIntPtr, Boolean)

Developers should use GetGlyph(UIntPtr, Boolean) rather than this deprecated method.

GlyphAtIndex(UIntPtr)

Developers should not use this deprecated method. Developers should use GetGlyph(UIntPtr, Boolean) instead.

Init() (Inherited from NSObject)
InitializeHandle(NativeHandle, String) (Inherited from NSObject)
InitializeHandle(NativeHandle) (Inherited from NSObject)
InsertTextContainer(NSTextContainer, IntPtr)

Inserts the specified NSTextContainer into TextContainers at the specified index.

InvalidateDisplayForCharacterRange(NSRange)

Invalidates the display for the given character range.

InvalidateDisplayForGlyphRange(NSRange)

Invalidates the display for the given glyph range.

InvalidateGlyphs(NSRange, IntPtr, IntPtr)
InvalidateGlyphs(NSRange, IntPtr, NSRange)

Invalidates the glyphs in the characterRange.

InvalidateGlyphs(NSRange, IntPtr)
InvalidateLayout(NSRange, IntPtr)
InvalidateLayout(NSRange, NSRange)

Invalidates the layout for the specified character range. Does not automatically trigger re-layout.

InvalidateLayout(NSRange)
Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
IsNotShownAttributeForGlyph(UIntPtr)

Whether the glyph at the specified index is shown.

IsValidGlyph(UIntPtr)

Whether the glyphIndex specifies a valid glyph.

MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MutableCopy() (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double) (Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
ProcessEditing(NSTextStorage, NSTextStorageEditActions, NSRange, IntPtr, NSRange)

Notifies the NSLayoutManager of an edit action.

RemoveObserver(NSObject, NSString, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, NSString) (Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, String) (Inherited from NSObject)
RemoveTextContainer(IntPtr)

Removes the specified NSTextContainer from the TextContainers array. Invalidates layout as necessary.

RespondsToSelector(Selector) (Inherited from NSObject)
SetAttachmentSize(CGSize, NSRange)

Sets the size for the glyph to draw within the glyphRange.

SetDrawsOutsideLineFragment(Boolean, UIntPtr)

Specifies whether the glyph at the specified index draws outside the bounds of its line segment.

SetExtraLineFragment(CGRect, CGRect, NSTextContainer)

Sets the details for the extra line fragment required when the text back is either totally empty or ends with a hard line break.

SetGlyphs(IntPtr, IntPtr, IntPtr, UIFont, NSRange)

Specifies the initial glyphs and glyph properties for the specified character range.

SetLineFragment(CGRect, NSRange, CGRect)

Associated the line fragment with bounds fragmentRect with the glyphs in glyphRange.

SetLocation(CGPoint, NSRange)

Sets the ___location for the first glyph in forStartOfGlyphRange.

SetNilValueForKey(NSString) (Inherited from NSObject)
SetNotShownAttribute(Boolean, UIntPtr)

Specifies that the glyph at the specified index should be marked as not shown.

SetTextContainer(NSTextContainer, NSRange)

Sets the NSTextContainer for the specified glyph range.

SetValueForKey(NSObject, NSString) (Inherited from NSObject)
SetValueForKeyPath(NativeHandle, NSString) (Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString) (Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString) (Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary) (Inherited from NSObject)
ShowGlyphs(Int16[], CGPoint[], IntPtr, UIFont, CGAffineTransform, NSDictionary, CGContext)

Renders glyphs at positions into graphicsContext.

ShowGlyphs(IntPtr, IntPtr, IntPtr, UIFont, CGAffineTransform, NSDictionary, CGContext)
ShowGlyphs(IntPtr, IntPtr, UIntPtr, UIFont, CGAffineTransform, NSDictionary, CGContext)
Strikethrough(NSRange, NSUnderlineStyle, CGRect, NSRange, CGPoint)

Draws a strikethrough through the glyphs at glyphRange.

TextContainerChangedGeometry(NSTextContainer)

Invalidates the layout information and glyphs for the specified NSTextContainer and any following.

ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSObject)
Underline(NSRange, NSUnderlineStyle, CGRect, NSRange, CGPoint)

Underlines the glyphs in glyphRange.

ValueForKey(NSString) (Inherited from NSObject)
ValueForKeyPath(NSString) (Inherited from NSObject)
ValueForUndefinedKey(NSString) (Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String) (Inherited from NSObject)

Extension Methods

Name Description
BrowserAccessibilityDeleteTextAtCursor(NSObject, IntPtr)
BrowserAccessibilityInsertTextAtCursor(NSObject, String)
GetAccessibilityLineEndPositionFromCurrentSelection(NSObject)
GetAccessibilityLineRangeForPosition(NSObject, IntPtr)
GetAccessibilityLineStartPositionFromCurrentSelection(NSObject)
GetBrowserAccessibilityAttributedValue(NSObject, NSRange)
GetBrowserAccessibilityContainerType(NSObject)
GetBrowserAccessibilityCurrentStatus(NSObject)
GetBrowserAccessibilityHasDomFocus(NSObject)
GetBrowserAccessibilityIsRequired(NSObject)
GetBrowserAccessibilityPressedState(NSObject)
GetBrowserAccessibilityRoleDescription(NSObject)
GetBrowserAccessibilitySelectedTextRange(NSObject)
GetBrowserAccessibilitySortDirection(NSObject)
GetBrowserAccessibilityValue(NSObject, NSRange)
SetBrowserAccessibilityContainerType(NSObject, BEAccessibilityContainerType)
SetBrowserAccessibilityCurrentStatus(NSObject, String)
SetBrowserAccessibilityHasDomFocus(NSObject, Boolean)
SetBrowserAccessibilityIsRequired(NSObject, Boolean)
SetBrowserAccessibilityPressedState(NSObject, BEAccessibilityPressedState)
SetBrowserAccessibilityRoleDescription(NSObject, String)
SetBrowserAccessibilitySelectedTextRange(NSObject, NSRange)
SetBrowserAccessibilitySortDirection(NSObject, String)
ProvideImageData(NSObject, IntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
ProvideImageToMTLTexture(NSObject, IMTLTexture, IMTLCommandBuffer, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
SetSharedObservers(NSObject, NSKeyValueSharedObserversSnapshot)
GetDebugDescription(INSObjectProtocol)
GetHandle(INativeObject)
GetNonNullHandle(INativeObject, String)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

AccessibilityHitTest(NSObject, CGPoint, UIEvent)
GetAccessibilityNextTextNavigationElement(NSObject)
GetAccessibilityNextTextNavigationElementBlock(NSObject)
GetAccessibilityPreviousTextNavigationElement(NSObject)
GetAccessibilityPreviousTextNavigationElementBlock(NSObject)
SetAccessibilityNextTextNavigationElement(NSObject, NSObject)
SetAccessibilityNextTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
SetAccessibilityPreviousTextNavigationElement(NSObject, NSObject)
SetAccessibilityPreviousTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
GetAccessibilityTextInputResponder(NSObject)
GetAccessibilityTextInputResponderHandler(NSObject)
SetAccessibilityTextInputResponder(NSObject, IUITextInput)
SetAccessibilityTextInputResponderHandler(NSObject, UITextInputReturnHandler)

Applies to

See also