Mac Developer Library

Developer

AppKit Framework Reference NSMutableAttributedString Additions Reference

Options
Deployment Target:

On This Page
Language:

NSMutableAttributedString

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.

Additions to the NSMutableAttributedString class primarily involve setting graphical attributes, such as font, super- or subscripting, and alignment, and making these attributes consistent after changes.

  • Applies the font attributes specified by mask to the characters in aRange.

    Declaration

    Swift

    func applyFontTraits(_ traitMask: NSFontTraitMask, range range: NSRange)

    Objective-C

    - (void)applyFontTraits:(NSFontTraitMask)traitMask range:(NSRange)range

    Discussion

    See the NSFontManager class specification for a description of the font traits available. Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the alignment characteristic of the paragraph style attribute for the characters in aRange to alignment.

    Declaration

    Swift

    func setAlignment(_ alignment: NSTextAlignment, range range: NSRange)

    Objective-C

    - (void)setAlignment:(NSTextAlignment)alignment range:(NSRange)range

    Discussion

    When attribute fixing takes place, this change will affect only paragraphs whose first character was included in aRange. Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the base writing direction for the characters in range to writingDirection.

    Declaration

    Swift

    func setBaseWritingDirection(_ writingDirection: NSWritingDirection, range range: NSRange)

    Objective-C

    - (void)setBaseWritingDirection:(NSWritingDirection)writingDirection range:(NSRange)range

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Decrements the value of the superscript attribute for characters in aRange by 1.

    Declaration

    Swift

    func subscriptRange(_ range: NSRange)

    Objective-C

    - (void)subscriptRange:(NSRange)range

    Discussion

    Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Increments the value of the superscript attribute for characters in aRange by 1.

    Declaration

    Swift

    func superscriptRange(_ range: NSRange)

    Objective-C

    - (void)superscriptRange:(NSRange)range

    Discussion

    Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Removes the superscript attribute from the characters in aRange.

    Declaration

    Swift

    func unscriptRange(_ range: NSRange)

    Objective-C

    - (void)unscriptRange:(NSRange)range

    Discussion

    Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.