Editar

Compartir a través de


NSLayoutManager Class

Definition

Responsible for layout of text stored in a NSTextStorage object.

[Foundation.Register("NSLayoutManager", true)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public class NSLayoutManager : Foundation.NSObject, Foundation.INSCoding, IDisposable
type NSLayoutManager = class
    inherit NSObject
    interface INSCoding
    interface INativeObject
    interface IDisposable
Inheritance
NSLayoutManager
Attributes
Implements

Remarks

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

The NSLayoutManager's TextStorage property holds a reference to a NSTextStorage object, that holds a potentially large amount of styled text. The NSLayoutManager's P:UIKit.NSLayoutManager.NSTextContainers 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

NSLayoutManager()

Default constructor, initializes a new instance of this class.

NSLayoutManager(IntPtr)

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

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 handle for this class.

DebugDescription

A developer-meaningful description of this object.

(Inherited from NSObject)
Delegate

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

Description

Description of the object, the Objective-C version of ToString.

(Inherited from NSObject)
ExtraLineFragmentRect

The RectangleF 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

Returns the current Objective-C retain count for the object.

(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

The NSTextStorage that holds the styled text to be laid out.

UsesFontLeading

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

WeakDelegate

An object that can respond to the delegate protocol for this type

Zone (Inherited from NSObject)

Methods

AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using NSString keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using string keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(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)
AddTemporaryAttribute(NSString, NSObject, NSRange)
AddTemporaryAttribute(String, NSObject, NSRange)
AddTemporaryAttributes(NSDictionary<NSString,NSObject>, NSRange)
AddTextContainer(NSTextContainer)

Appends a NSTextContainer to the TextContainers property.

AttachmentSizeForGlyphAtIndex(nuint)

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

AwakeFromNib()

Called after the object has been loaded from the nib file. Overriders must call base.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)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
Bind(String, NSObject, String, NSDictionary)
Obsolete.
(Inherited from NSObject)
BindingInfo(String)
Obsolete.
(Inherited from NSObject)
BindingOptionDescriptions(String)
Obsolete.
(Inherited from NSObject)
BindingValueClass(String)
Obsolete.
(Inherited from NSObject)
BoundingRectForGlyphRange(NSRange, NSTextContainer)

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

CharacterIndexForGlyphAtIndex(nuint)

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

CharacterIndexForPoint(CGPoint, NSTextContainer, nfloat)
Obsolete.

Gets the index of the character at in .

CharacterRangeForGlyphRange(NSRange, NSRange)

The range of characters that generated the specified glyph range.

CharacterRangeForGlyphRange(NSRange)
Obsolete.

The range of characters that generated the glyphs in the specified glyph range.

CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
ConformsToProtocol(IntPtr)

Invoked to determine if this object implements the specified protocol.

(Inherited from NSObject)
Copy()

Performs a copy of the underlying Objective-C object.

(Inherited from NSObject)
DangerousAutorelease() (Inherited from NSObject)
DangerousRelease() (Inherited from NSObject)
DangerousRetain() (Inherited from NSObject)
DidChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates a change occurred to the indexes for a to-many relationship.

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

Indicates that a change occurred on the specified key.

(Inherited from NSObject)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)

Releases the resources used by the NSLayoutManager object.

DoesNotRecognizeSelector(Selector)

Indicates that this object does not recognize the specified selector.

(Inherited from NSObject)
DrawBackgroundForGlyphRange(NSRange, CGPoint)

Draws background marks for the given glyph range.

DrawGlyphs(NSRange, CGPoint)

Draws the specified glyph range.

DrawsOutsideLineFragmentForGlyphAtIndex(nuint)

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 .

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

Underlines the glyphs in .

EncodeTo(NSCoder)

Encodes the state of the object on 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 within .

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)
ExposedBindings() (Inherited from NSObject)
FillBackground(IntPtr, nuint, NSRange, UIColor)
FractionOfDistanceThroughGlyphForPoint(CGPoint, NSTextContainer)

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

GetBindingInfo(NSString) (Inherited from NSObject)
GetBindingOptionDescriptions(NSString) (Inherited from NSObject)
GetBindingValueClass(NSString) (Inherited from NSObject)
GetCharacterIndex(CGPoint, NSTextContainer, nfloat)
GetCharacterIndex(CGPoint, NSTextContainer)
GetCharacterRange(NSRange, IntPtr)
GetCharacterRange(NSRange, NSRange)
GetCharacterRange(NSRange)
GetDefaultBaselineOffset(UIFont)
GetDefaultLineHeight(UIFont)
GetDictionaryOfValuesFromKeys(NSString[])

Retrieves the values of the specified keys.

(Inherited from NSObject)
GetFirstUnlaidCharacterIndex(nuint, nuint)

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

GetGlyph(nuint, Boolean)

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

GetGlyph(nuint)

Retrieves the glyph at .

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

The range of glyph indices contained in the specified NSTextContainer.

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

Fills with the glyphs in .

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

Generates a hash code for the current instance.

(Inherited from NSObject)
GetLineFragmentInsertionPoints(nuint, Boolean, Boolean, IntPtr, IntPtr)
GetLineFragmentInsertionPoints(nuint, Boolean, Boolean, nfloat[], nint[])

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

GetLineFragmentRect(nuint, Boolean)
GetLineFragmentRect(nuint, IntPtr)
GetLineFragmentRect(nuint, NSRange, Boolean)

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

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

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

GetLineFragmentUsedRect(nuint, NSRange)
GetLineFragmentUsedRect(nuint)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeField(String)
Obsolete.
(Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetProperty(nuint)
GetTemporaryAttribute(NSString, nuint, IntPtr, NSRange)
GetTemporaryAttribute(NSString, nuint, IntPtr)
GetTemporaryAttribute(NSString, nuint, NSRange, NSRange)
GetTemporaryAttribute(NSString, nuint, NSRange)
GetTemporaryAttribute(NSString, nuint, NSRange)
GetTemporaryAttribute(NSString, nuint)
GetTemporaryAttributes(nuint, IntPtr, NSRange)
GetTemporaryAttributes(nuint, IntPtr)
GetTemporaryAttributes(nuint, NSRange, NSRange)
GetTemporaryAttributes(nuint, NSRange)
GetTemporaryAttributes(nuint, NSRange)
GetTemporaryAttributes(nuint)
GetTextContainer(nuint, Boolean)
GetTextContainer(nuint, NSRange, Boolean)

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

GetTextContainer(nuint, NSRange)
GetTextContainer(nuint)
GetTruncatedGlyphRangeInLineFragment(nuint)
GetUsedRectForTextContainer(NSTextContainer)

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

GlyphAtIndex(nuint, Boolean)

Developers should use M:UIKit.NSLayoutManager.GetGlyph* rather than this deprecated method.

GlyphAtIndex(nuint)

Developers should not use this deprecated method. Developers should use M:UIKit.NSLayoutManager.GetGlyph* instead.

GlyphIndexForCharacterAtIndex(nuint)

The glyph index for the character at the specified index.

GlyphIndexForPoint(CGPoint, NSTextContainer, nfloat)

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

GlyphIndexForPoint(CGPoint, NSTextContainer)

Developers should call GlyphIndexForPoint(CGPoint, NSTextContainer, nfloat) rather than this primitive method.

GlyphRangeForBoundingRect(CGRect, NSTextContainer)

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

GlyphRangeForBoundingRectWithoutAdditionalLayout(CGRect, NSTextContainer)

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

GlyphRangeForCharacterRange(NSRange, NSRange)
Obsolete.

The range of glyphs generated for the specified characters.

GlyphRangeForCharacterRange(NSRange)
Obsolete.

The range of glyphs generated for the specified characters.

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

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, nint, NSRange)

Invalidates the glyphs in the .

InvalidateGlyphs(NSRange, nint)
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)
IsValidGlyphIndex(nuint)

Whether the glyphIndex specifies a valid glyph.

LineFragmentRectForGlyphAtIndex(nuint, NSRange)
Obsolete.

Returns the rectangle for the line fragment in which the glyph at is laid out.

LineFragmentRectForGlyphAtIndex(nuint)
Obsolete.

The RectangleF enclosing the line fragment in which the given glyph is laid out.

LineFragmentUsedRectForGlyphAtIndex(nuint, NSRange)
Obsolete.

Returns the usage rectangle for the line fragment in which the glyph at is laid out.

LineFragmentUsedRectForGlyphAtIndex(nuint)
Obsolete.

The RectangleF enclosing the line fragment for the glyph at the specified glyphIndex.

LocationForGlyphAtIndex(nuint)

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

MarkDirty()

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

(Inherited from NSObject)
MutableCopy()

Creates a mutable copy of the specified NSObject.

(Inherited from NSObject)
NotShownAttributeForGlyphAtIndex(nuint)

Whether the glyph at the specified index is shown.

ObjectDidEndEditing(NSObject) (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr)

Indicates that the value at the specified keyPath relative to this object has changed.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double)

Invokes the selector on the current instance and if the obj is not null, it passes this as its single parameter.

(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, nint, NSRange)

Notifies the NSLayoutManager of an edit action.

PropertyForGlyphAtIndex(nuint)
Obsolete.

The NSGlyphProperty for the glyph at the specified index.

RangeOfNominallySpacedGlyphsContainingIndex(nuint)

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.

RemoveObserver(NSObject, NSString, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, NSString)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

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

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, String)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveTemporaryAttribute(NSString, NSRange)
RemoveTemporaryAttribute(String, NSRange)
RemoveTextContainer(nint)

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

ReplaceTextStorage(NSTextStorage)
RespondsToSelector(Selector)

Whether this object recognizes the specified selector.

(Inherited from NSObject)
SetAttachmentSize(CGSize, NSRange)

Sets the size for the glyph to draw within the .

SetDrawsOutsideLineFragment(Boolean, nuint)

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

SetExtraLineFragmentRect(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.

SetLineFragmentRect(CGRect, NSRange, CGRect)

Associated the line fragment with bounds with the glyphs in .

SetLocation(CGPoint, NSRange)

Sets the for the first glyph in .

SetNativeField(String, NSObject)
Obsolete.
(Inherited from NSObject)
SetNilValueForKey(NSString)

Sets the value of the specified key to null.

(Inherited from NSObject)
SetNotShownAttribute(Boolean, nuint)

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

SetTemporaryAttributes(NSDictionary<NSString,NSObject>, NSRange)
SetTextContainer(NSTextContainer, NSRange)

Sets the NSTextContainer for the specified glyph range.

SetValueForKey(NSObject, NSString)

Sets the value of the property specified by the key to the specified value.

(Inherited from NSObject)
SetValueForKeyPath(IntPtr, NSString)

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

(Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

(Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString)

Indicates an attempt to write a value to an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary)

Sets the values of this NSObject to those in the specified dictionary.

(Inherited from NSObject)
ShowCGGlyphs(Int16[], CGPoint[], nuint, UIFont, CGAffineTransform, NSDictionary, CGContext)

Renders at into .

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

Draws a strikethrough through the glyphs at .

TextContainerChangedGeometry(NSTextContainer)

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

TextContainerChangedTextView(NSTextContainer)
TextContainerForGlyphAtIndex(nuint, NSRange)
Obsolete.

Gets the NSTextContainer containing the glyph at .

TextContainerForGlyphAtIndex(nuint)
Obsolete.

The NSTextContainer in which the specified glyph is laid out.

ToString()

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

(Inherited from NSObject)
TruncatedGlyphRangeInLineFragmentForGlyphAtIndex(nuint)
Obsolete.

The range of truncated glyphs for a line fragment containing the specified index.

Unbind(NSString) (Inherited from NSObject)
Unbind(String)
Obsolete.
(Inherited from NSObject)
Underline(NSRange, NSUnderlineStyle, CGRect, NSRange, CGPoint)

Underlines the glyphs in .

ValueForKey(NSString)

Returns the value of the property associated with the specified key.

(Inherited from NSObject)
ValueForKeyPath(NSString)

Returns the value of a property that can be reached using a keypath.

(Inherited from NSObject)
ValueForUndefinedKey(NSString)

Indicates an attempt to read a value of an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates that the values of the specified indices in the specified key are about to change.

(Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String)

Indicates that the value of the specified key is about to change.

(Inherited from NSObject)

Extension Methods

GetDebugDescription(INSObjectProtocol)
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.

Applies to

See also