Mac Developer Library

Developer

AppKit Framework Reference NSTextBlock Class Reference

Options
Deployment Target:

On This Page
Language:

NSTextBlock

NSTextBlock objects represent a block of text laid out in a subregion of the text container. Text blocks appear as attributes on paragraphs, as part of the paragraph style.

The most important subclass is NSTextTableBlock, which represents a block of text that appears as a cell in a table. The table itself is represented by a separate class, NSTextTable, which is referenced by all of its NSTextTableBlock objects and which controls their sizing and positioning.

  • Initializes and returns an empty text block object.

    Declaration

    Swift

    init()

    Objective-C

    - (instancetype)init

    Return Value

    An initialized text block object.

    Discussion

    This is the designated initializer for NSTextBlock.

    Availability

    Available in OS X v10.4 and later.

  • The following constants specify values used by the methods setValue:type:forDimension: and valueTypeForDimension:

    Declaration

    Swift

    enum NSTextBlockValueType : UInt { case AbsoluteValueType case PercentageValueType }

    Objective-C

    enum { NSTextBlockAbsoluteValueType = 0, NSTextBlockPercentageValueType = 1 }; typedef NSUInteger NSTextBlockValueType;

    Constants

    • AbsoluteValueType

      NSTextBlockAbsoluteValueType

      Absolute value in points.

      Available in OS X v10.4 and later.

    • PercentageValueType

      NSTextBlockPercentageValueType

      Percentage value (out of 100).

      Available in OS X v10.4 and later.

    • NSTextBlockValueType

      A type defined for the text block value type constants.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • The following constants specify values used by the methods setValue:type:forDimension:, valueForDimension:, and valueTypeForDimension:.

    Declaration

    Swift

    enum NSTextBlockDimension : UInt { case Width case MinimumWidth case MaximumWidth case Height case MinimumHeight case MaximumHeight }

    Objective-C

    enum { NSTextBlockWidth = 0, NSTextBlockMinimumWidth = 1, NSTextBlockMaximumWidth = 2, NSTextBlockHeight = 4, NSTextBlockMinimumHeight = 5, NSTextBlockMaximumHeight = 6 }; typedef NSUInteger NSTextBlockDimension;

    Constants

    • Width

      NSTextBlockWidth

      Width of the text block.

      Available in OS X v10.4 and later.

    • MinimumWidth

      NSTextBlockMinimumWidth

      Minimum width of the text block.

      Available in OS X v10.4 and later.

    • MaximumWidth

      NSTextBlockMaximumWidth

      Maximum width of the text block.

      Available in OS X v10.4 and later.

    • Height

      NSTextBlockHeight

      Height of the text block.

      Available in OS X v10.4 and later.

    • MinimumHeight

      NSTextBlockMinimumHeight

      Minimum height of the text block.

      Available in OS X v10.4 and later.

    • MaximumHeight

      NSTextBlockMaximumHeight

      Maximum height of the text block.

      Available in OS X v10.4 and later.

    • NSTextBlockDimension

      A type defined for the text block dimension constants.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Declaration

    Swift

    enum NSTextBlockLayer : Int { case Padding case Border case Margin }

    Objective-C

    enum { NSTextBlockPadding = -1, NSTextBlockBorder = 0, NSTextBlockMargin = 1 }; typedef NSInteger NSTextBlockLayer;

    Constants

    • Padding

      NSTextBlockPadding

      Padding of the text block: space surrounding the content area extending to the border.

      Available in OS X v10.4 and later.

    • Border

      NSTextBlockBorder

      Border of the text block: space between padding and margin, typically colored to present a visible boundary.

      Available in OS X v10.4 and later.

    • Margin

      NSTextBlockMargin

      Margin of the text block: space surrounding the border.

      Available in OS X v10.4 and later.

    • NSTextBlockLayer

      A type defined for the text block layer constants.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • The following constants specify values used by the methods setVerticalAlignment: and verticalAlignment.

    Declaration

    Swift

    enum NSTextBlockVerticalAlignment : UInt { case TopAlignment case MiddleAlignment case BottomAlignment case BaselineAlignment }

    Objective-C

    enum { NSTextBlockTopAlignment = 0, NSTextBlockMiddleAlignment = 1, NSTextBlockBottomAlignment = 2, NSTextBlockBaselineAlignment = 3 }; typedef NSUInteger NSTextBlockVerticalAlignment;

    Constants

    • TopAlignment

      NSTextBlockTopAlignment

      Aligns adjacent blocks at their top.

      Available in OS X v10.4 and later.

    • MiddleAlignment

      NSTextBlockMiddleAlignment

      Aligns adjacent blocks at their middle.

      Available in OS X v10.4 and later.

    • BottomAlignment

      NSTextBlockBottomAlignment

      Aligns adjacent blocks at their bottom.

      Available in OS X v10.4 and later.

    • BaselineAlignment

      NSTextBlockBaselineAlignment

      Aligns adjacent blocks at the baseline of the first line of text in the block.

      Available in OS X v10.4 and later.

    • NSTextBlockVerticalAlignment

      A type defined for the text block vertical alignment constants.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.