Mac Developer Library

Developer

AppKit Framework Reference NSTextTab Class Reference

Options
Deployment Target:

On This Page
Language:

NSTextTab

An NSTextTab object represents a tab in an NSParagraphStyle object, storing an alignment type and location. NSTextTab objects are most frequently used with the Application Kit’s text system and with NSRulerView in NSRulerView Class Reference and NSRulerMarker in NSRulerMarker Class Objective-C Reference objects. See the appropriate class specifications for more information on these uses. More...

Inheritance


Conforms To


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.0 and later.
  • Initializes a newly allocated NSTextTab with an alignment of type at location on the paragraph.

    Declaration

    Swift

    init(type type: NSTextTabType, location loc: CGFloat)

    Objective-C

    - (instancetype)initWithType:(NSTextTabType)type location:(CGFloat)loc

    Discussion

    The location is relative to the back margin, based on the line sweep direction of the paragraph. type can be any of the values described in NSTextTabType.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Initializes a text tab with the text alignment, location, and options.

    Declaration

    Swift

    init(textAlignment alignment: NSTextAlignment, location loc: CGFloat, options options: [NSObject : AnyObject]?)

    Objective-C

    - (instancetype)initWithTextAlignment:(NSTextAlignment)alignment location:(CGFloat)loc options:(NSDictionary *)options

    Discussion

    The text alignment is used to determine the position of text inside the tab column. See NSTextTabType for a mapping between alignments and tab stop types

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Returns the receiver’s ruler location relative to the back margin.

    Declaration

    Swift

    var location: CGFloat { get }

    Objective-C

    @property(readonly) CGFloat location

    Return Value

    The receiver’s ruler location relative to the back margin.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s tab stop type.

    Declaration

    Swift

    var tabStopType: NSTextTabType { get }

    Objective-C

    @property(readonly) NSTextTabType tabStopType

    Return Value

    The receiver’s tab stop type. Possible values are listed in NSTextTabType.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the text alignment of the receiver.

    Declaration

    Swift

    var alignment: NSTextAlignment { get }

    Objective-C

    @property(readonly) NSTextAlignment alignment

    Return Value

    The text alignment of the receiver as an NSTextAlignment constant

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Returns the dictionary of attributes associated with the receiver.

    Declaration

    Swift

    var options: [NSObject : AnyObject]? { get }

    Objective-C

    @property(readonly, copy) NSDictionary *options

    Return Value

    The dictionary of attributes associated with the receiver.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.3 and later.

Data Types

  • These constants describe the various type of tab stop.

    Declaration

    Swift

    enum NSTextTabType : UInt { case LeftTabStopType case RightTabStopType case CenterTabStopType case DecimalTabStopType }

    Objective-C

    typedef enum _NSTextTabType { NSLeftTabStopType = 0, NSRightTabStopType, NSCenterTabStopType, NSDecimalTabStopType } NSTextTabType;

    Constants

    • LeftTabStopType

      NSLeftTabStopType

      A left-aligned tab stop.

      Available in OS X v10.0 and later.

    • RightTabStopType

      NSRightTabStopType

      A right-aligned tab stop.

      Available in OS X v10.0 and later.

    • CenterTabStopType

      NSCenterTabStopType

      A center-aligned tab stop.

      Available in OS X v10.0 and later.

    • DecimalTabStopType

      NSDecimalTabStopType

      Aligns columns of numbers by the decimal point.

      Available in OS X v10.0 and later.

    Discussion

    The following mappings define the conversions between text alignment in NSTextTab and tab stop types defined by NSTextTab:

    Alignment

    Tab Stop Type

    NSLeftTextAlignment

    NSLeftTabStopType

    NSRightTextAlignment

    NSRightTabStopType

    NSCenterTextAlignment

    NSCenterTabStopType

    NSJustifiedTextAlignment

    NSLeftTabStopType

    NSNaturalTextAlignment

    NSLeftTabStopType or NSRightTabStopType, depending on the user setting

    NSRightTextAlignment with terminator

    NSDecimalTabStopType

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • This constant specifies the terminating character for a tab column.

    Declaration

    Swift

    var NSTabColumnTerminatorsAttributeName: NSString!

    Objective-C

    NSString *NSTabColumnTerminatorsAttributeName;

    Constants

    • NSTabColumnTerminatorsAttributeName

      NSTabColumnTerminatorsAttributeName

      The value is an NSCharacterSet object.

      The character set is used to determine the terminating character for a tab column. The tab and newline characters are implied even if they don’t exist in the character set. This attribute is optional.

      Available in OS X v10.3 and later.

    Import Statement