Share via


NSAttributedString Class

Definition

[Foundation.Register("NSAttributedString", true)]
public class NSAttributedString : Foundation.NSObject, Foundation.INSItemProviderReading, Foundation.INSItemProviderWriting, Foundation.INSMutableCopying, Foundation.INSSecureCoding, IDisposable
[Foundation.Register("NSAttributedString", true)]
public class NSAttributedString : Foundation.NSObject, AppKit.INSPasteboardReading, AppKit.INSPasteboardWriting, Foundation.INSMutableCopying, Foundation.INSSecureCoding, IDisposable
[Foundation.Register("NSAttributedString", true)]
public class NSAttributedString : Foundation.NSObject, Foundation.INSMutableCopying, Foundation.INSSecureCoding, IDisposable
[<Foundation.Register("NSAttributedString", true)>]
type NSAttributedString = class
    inherit NSObject
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSCopying
    interface INSItemProviderReading
    interface INSItemProviderWriting
    interface INSMutableCopying
    interface INSSecureCoding
[<Foundation.Register("NSAttributedString", true)>]
type NSAttributedString = class
    inherit NSObject
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSCopying
    interface INSMutableCopying
    interface INSSecureCoding
    interface INSPasteboardReading
    interface INSPasteboardWriting
[<Foundation.Register("NSAttributedString", true)>]
type NSAttributedString = class
    inherit NSObject
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSCopying
    interface INSMutableCopying
    interface INSSecureCoding
Inheritance
NSAttributedString
Derived
Attributes
Implements

Constructors

NSAttributedString()

Creates a new NSAttributedString with default values.

NSAttributedString(NativeHandle)

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

NSAttributedString(NSAttributedString)
NSAttributedString(NSCoder)

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

NSAttributedString(NSData, NSAttributedStringDocumentAttributes, NSDictionary, NSError)
NSAttributedString(NSData, NSAttributedStringDocumentAttributes, NSDictionary)
NSAttributedString(NSData, NSAttributedStringDocumentAttributes, NSError)
NSAttributedString(NSData, NSAttributedStringMarkdownParsingOptions, NSUrl, NSError)
NSAttributedString(NSData, NSDictionary, NSDictionary, NSError)
NSAttributedString(NSData, NSDictionary, NSDictionary)
NSAttributedString(NSData, NSDictionary)
NSAttributedString(NSData, NSError)
NSAttributedString(NSData, NSUrl, NSDictionary)
NSAttributedString(NSFileWrapper, NSDictionary)
NSAttributedString(NSObjectFlag)

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

NSAttributedString(NSUrl, NSAttributedStringDocumentAttributes, NSDictionary, NSError)
NSAttributedString(NSUrl, NSAttributedStringDocumentAttributes, NSError)
NSAttributedString(NSUrl, NSAttributedStringMarkdownParsingOptions, NSUrl, NSError)
NSAttributedString(NSUrl, NSDictionary, NSDictionary, NSError)
NSAttributedString(NSUrl, NSDictionary)
NSAttributedString(NSUrl, NSError)
NSAttributedString(String, CTStringAttributes)

Creates an NSAttributedString for use with CoreText rendering functions.

NSAttributedString(String, NSAttributedStringMarkdownParsingOptions, NSUrl, NSError)
NSAttributedString(String, NSDictionary)
NSAttributedString(String, NSDictionary)
NSAttributedString(String, NSFont, NSColor, NSColor, NSColor, NSColor, NSColor, NSUnderlineStyle, NSUnderlineStyle, NSParagraphStyle, Single, NSShadow, NSUrl, Boolean, NSTextAttachment, NSLigatureType, Single, Single, Single, Single, NSCursor, String, Int32, NSGlyphInfo, NSArray, Boolean, NSTextLayoutOrientation, NSTextAlternatives, NSSpellingState)
NSAttributedString(String, NSStringAttributes)
NSAttributedString(String, UIFont, UIColor, UIColor, UIColor, NSParagraphStyle, NSLigatureType, Single, NSUnderlineStyle, NSShadow, Single, NSUnderlineStyle)

Creates a UIKit attributed string with the specified attributes in the parameters.

NSAttributedString(String, UIStringAttributes)
NSAttributedString(String)

Properties

AccessibilityAttributedUserInputLabels (Inherited from NSObject)
AccessibilityRespondsToUserInteraction (Inherited from NSObject)
AccessibilityTextualContext (Inherited from NSObject)
AccessibilityUserInputLabels (Inherited from NSObject)
AttributedStringByInflectingString
Class (Inherited from NSObject)
ClassHandle

The Objective-C class handle for this class.

CocoaVersionDocumentAttribute

Represents the value associated with the constant 'NSCocoaVersionDocumentAttribute'.

ContainsAttachments
DebugDescription (Inherited from NSObject)
Description (Inherited from NSObject)
ExposedBindings (Inherited from NSObject)
Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
Length
LowLevelValue
ReadableTypeIdentifiers
RetainCount (Inherited from NSObject)
Self (Inherited from NSObject)
Size
SourceTextScalingDocumentAttribute

Represents the value associated with the constant 'NSSourceTextScalingDocumentAttribute'.

Superclass (Inherited from NSObject)
SuperHandle

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

(Inherited from NSObject)
TextLayoutSectionOrientation
TextLayoutSectionRange
TextLayoutSectionsAttribute
TextScalingDocumentAttribute

Represents the value associated with the constant 'NSTextScalingDocumentAttribute'.

UnderlineByWordMaskAttributeName
Value

Contents of the object as a string.

WritableTypeIdentifiers
WritableTypeIdentifiersForItemProvider
Zone (Inherited from NSObject)

Methods

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)
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, NSBindingOptions) (Inherited from NSObject)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
BoundingRectWithSize(CGSize, NSStringDrawingOptions)
CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
ConformsToProtocol(NativeHandle) (Inherited from NSObject)
ContainsAttachmentsInRange(NSRange)
Copy() (Inherited from NSObject)
Copy(NSZone)

Performs a copy of the underlying Objective-C object.

Create(NSAdaptiveImageGlyph, NSDictionary<NSString,NSObject>)
Create(NSAdaptiveImageGlyph, NSDictionary<NSString,NSObject>)
Create(NSData, NSAttributedStringDocumentAttributes, NSDictionary, NSError)

Create a new NSAttributedString.

Create(NSData, NSAttributedStringDocumentAttributes, NSError)

Create a new NSAttributedString.

Create(NSData, NSAttributedStringMarkdownParsingOptions, NSUrl, NSError)

Create a new NSAttributedString from markdown data.

Create(NSData, NSDictionary, NSDictionary, NSError)

Create a new NSAttributedString.

Create(NSData, NSError)

Create a new NSAttributedString.

Create(NSFileWrapper, NSDictionary)

Create an NSAttributedString by parsing the wrapper with RTFD data.

Create(NSUrl, NSAttributedStringDocumentAttributes, NSDictionary, NSError)

Create a new NSAttributedString.

Create(NSUrl, NSAttributedStringDocumentAttributes, NSError)

Create a new NSAttributedString.

Create(NSUrl, NSAttributedStringMarkdownParsingOptions, NSUrl, NSError)

Create a new NSAttributedString from a markdown file.

Create(NSUrl, NSDictionary, NSDictionary, NSError)

Create a new NSAttributedString.

Create(NSUrl, NSError)

Create a new NSAttributedString.

Create(String, NSAttributedStringMarkdownParsingOptions, NSUrl, NSError)

Create a new NSAttributedString from a string with markdown.

CreateWithDocFormat(NSData, NSDictionary)

Create an NSAttributedString by parsing the wordDocFormat data as a Microsoft Word document.

CreateWithHTML(NSData, NSAttributedStringDocumentAttributes, NSDictionary)

Create an NSAttributedString by parsing the htmlData data as HTML.

CreateWithHTML(NSData, NSDictionary, NSDictionary)

Create an NSAttributedString by parsing the htmlData data as HTML.

CreateWithHTML(NSData, NSDictionary)

Create an NSAttributedString by parsing the htmlData data as HTML.

CreateWithHTML(NSData, NSUrl, NSDictionary)

Create an NSAttributedString by parsing the htmlData data as HTML.

CreateWithRTF(NSData, NSDictionary)

Create an NSAttributedString by parsing the rtfData data as RTF.

CreateWithRTFD(NSData, NSDictionary)

Create an NSAttributedString by parsing the rtfdData data as RTFD.

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)

Releases the resources used by the NSObject object.

(Inherited from NSObject)
DoesNotRecognizeSelector(Selector) (Inherited from NSObject)
DoubleClick(UIntPtr)
DrawString(CGPoint)

Draws the string at the specified point.

DrawString(CGRect, NSStringDrawingOptions, NSStringDrawingContext)
DrawString(CGRect, NSStringDrawingOptions)
DrawString(CGRect)
EncodeTo(NSCoder)

Encodes the state of the object using the provided encoder.

EnumerateAttribute(NSString, NSRange, NSAttributedStringEnumeration, NSAttributedStringCallback)
EnumerateAttributes(NSRange, NSAttributedStringEnumeration, NSAttributedRangeCallback)
Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
FromAttachment(NSTextAttachment, NSDictionary<NSString,NSObject>)
FromAttachment(NSTextAttachment, NSDictionary<NSString,NSObject>)
FromAttachment(NSTextAttachment)
FromAttachment(NSTextAttachment)
GetAppKitAttributes(IntPtr, NSRange, NSRange)
GetAppKitAttributes(IntPtr, NSRange)
GetAttribute(String, IntPtr, NSRange, NSRange)
GetAttribute(String, IntPtr, NSRange)
GetAttributes(IntPtr, NSRange, NSRange)
GetAttributes(IntPtr, NSRange)
GetBindingInfo(NSString) (Inherited from NSObject)
GetBindingOptionDescriptions(NSString) (Inherited from NSObject)
GetBindingValueClass(NSString) (Inherited from NSObject)
GetBoundingRect(CGSize, NSStringDrawingOptions, NSStringDrawingContext)
GetCoreTextAttributes(IntPtr, NSRange, NSRange)
GetCoreTextAttributes(IntPtr, NSRange)
GetData(NSRange, NSAttributedStringDocumentAttributes, NSError)
GetData(NSRange, NSDictionary, NSError)
GetDataFromRange(NSRange, NSAttributedStringDocumentAttributes, NSError)
GetDataFromRange(NSRange, NSDictionary, NSError)
GetDictionaryOfValuesFromKeys(NSString[]) (Inherited from NSObject)
GetDocFormat(NSRange, NSAttributedStringDocumentAttributes)
GetDocFormat(NSRange, NSDictionary)
GetFileWrapper(NSRange, NSAttributedStringDocumentAttributes, NSError)
GetFileWrapper(NSRange, NSDictionary, NSError)
GetFileWrapperFromRange(NSRange, NSAttributedStringDocumentAttributes, NSError)
GetFileWrapperFromRange(NSRange, NSDictionary, NSError)
GetFontAttributes(NSRange)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetItemNumber(NSTextList, UIntPtr)
GetItemProviderVisibilityForTypeIdentifier(String)
GetLineBreak(UIntPtr, NSRange)
GetLineBreakByHyphenating(UIntPtr, NSRange)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetNextWord(UIntPtr, Boolean)
GetObject(NSData, String, NSError)
GetPasteboardPropertyListForType(String)
GetRange(NSTextBlock, UIntPtr)
GetRange(NSTextList, UIntPtr)
GetRange(NSTextTable, UIntPtr)
GetReadableTypesForPasteboard(NSPasteboard)
GetReadingOptionsForType(String, NSPasteboard)
GetRtf(NSRange, NSAttributedStringDocumentAttributes)
GetRtf(NSRange, NSDictionary)
GetRtfd(NSRange, NSAttributedStringDocumentAttributes)
GetRtfd(NSRange, NSDictionary)
GetRtfdFileWrapper(NSRange, NSAttributedStringDocumentAttributes)
GetRtfdFileWrapper(NSRange, NSDictionary)
GetRulerAttributes(NSRange)
GetUIKitAttributes(IntPtr, NSRange, NSRange)
GetUIKitAttributes(IntPtr, NSRange)
GetUrl(UIntPtr, NSRange)
GetWritableTypesForPasteboard(NSPasteboard)
GetWritingOptionsForType(String, NSPasteboard)
Init() (Inherited from NSObject)
InitializeHandle(NativeHandle, String) (Inherited from NSObject)
InitializeHandle(NativeHandle) (Inherited from NSObject)
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(NSAttributedString)
IsEqual(NSObject) (Inherited from NSObject)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
LoadData(String, Action<NSData,NSError>)

Implement this method to customize the loading of data by an NSItemProvider.

LoadDataAsync(String, NSProgress)
LoadDataAsync(String)

Asynchronously loads data for the identified type from an item provider, returning a task that contains the data.

LoadFromHtml(NSData, NSAttributedStringDocumentAttributes, NSAttributedStringCompletionHandler)
LoadFromHtml(NSData, NSDictionary, NSAttributedStringCompletionHandler)
LoadFromHtml(NSUrl, NSAttributedStringDocumentAttributes, NSAttributedStringCompletionHandler)
LoadFromHtml(NSUrl, NSDictionary, NSAttributedStringCompletionHandler)
LoadFromHtml(NSUrlRequest, NSAttributedStringDocumentAttributes, NSAttributedStringCompletionHandler)
LoadFromHtml(NSUrlRequest, NSDictionary, NSAttributedStringCompletionHandler)
LoadFromHtml(String, NSAttributedStringDocumentAttributes, NSAttributedStringCompletionHandler)
LoadFromHtml(String, NSDictionary, NSAttributedStringCompletionHandler)
LoadFromHtmlAsync(NSData, NSAttributedStringDocumentAttributes)
LoadFromHtmlAsync(NSData, NSDictionary)
LoadFromHtmlAsync(NSUrl, NSAttributedStringDocumentAttributes)
LoadFromHtmlAsync(NSUrl, NSDictionary)
LoadFromHtmlAsync(NSUrlRequest, NSAttributedStringDocumentAttributes)
LoadFromHtmlAsync(NSUrlRequest, NSDictionary)
LoadFromHtmlAsync(String, NSAttributedStringDocumentAttributes)
LoadFromHtmlAsync(String, NSDictionary)
LowLevelGetAttributes(IntPtr, IntPtr)
LowLevelGetAttributes(IntPtr, NSRange)

Low-level version that provides an NSDictionary for the attributes in the specified range.

MarkDirty()

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

(Inherited from NSObject)
MutableCopy() (Inherited from NSObject)
MutableCopy(NSZone)
ObjectDidEndEditing(NSObject) (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)
PrefersRtfdInRange(NSRange)
PrepareForInterfaceBuilder() (Inherited from NSObject)
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)
RespondsToSelector(Selector) (Inherited from NSObject)
SetNilValueForKey(NSString) (Inherited from NSObject)
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)
Substring(IntPtr, IntPtr)
ToString()

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

(Inherited from NSObject)
Unbind(NSString) (Inherited from NSObject)
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

BoundingRectWithSize(NSAttributedString, CGSize, NSStringDrawingOptions, NSStringDrawingContext)
DrawWithRect(NSAttributedString, CGRect, NSStringDrawingOptions, NSStringDrawingContext)
ObjectDidBeginEditing(NSObject, INSEditor)
ObjectDidEndEditing(NSObject, INSEditor)
GetValidModes(NSObject, NSFontPanel)
ValidateToolbarItem(NSObject, NSToolbarItem)
GetWritingOptionsForType(INSPasteboardWriting, String, NSPasteboard)
DrawAtPoint(NSAttributedString, CGPoint)
DrawInRect(NSAttributedString, CGRect)
GetSize(NSAttributedString)
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)
GetItemProviderVisibilityForTypeIdentifier(INSItemProviderWriting, String)
GetWritableTypeIdentifiersForItemProvider(INSItemProviderWriting)
LoadDataAsync(INSItemProviderWriting, String, NSProgress)
LoadDataAsync(INSItemProviderWriting, String)

Asynchronously loads data for the identified type from an item provider, returning a task that contains the data.

SetSharedObservers(NSObject, NSKeyValueSharedObserversSnapshot)
GetDebugDescription(INSObjectProtocol)
GetHandle(INativeObject)
GetNonNullHandle(INativeObject, String)
AcceptsPreviewPanelControl(NSObject, QLPreviewPanel)
BeginPreviewPanelControl(NSObject, QLPreviewPanel)
EndPreviewPanelControl(NSObject, QLPreviewPanel)
ContainsAttachments(NSAttributedString, NSRange)

Returns true if the current NSAttributedString contains attachments in the specified range.

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