| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSParagraphStyle.h |
| Related sample code |
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 and NSRulerMarker objects. See the appropriate class specifications for more information on these uses.
The text system supports four alignment types: left, center, right, and decimal (based on the decimal separator character of the locale in effect). These alignment types are absolute, not based on the line sweep direction of text. For example, tabbed text is always positioned to the left of a right-aligned tab, whether the line sweep direction is left to right or right to left. A tab’s location, on the other hand, is relative to the back margin. A tab set at 1.5”, for example, is at 1.5” from the right in right to left text.
Returns the text alignment of the receiver.
- (NSTextAlignment)alignment
The text alignment of the receiver as an NSTextAlignment constant
NSParagraphStyle.hInitializes a text tab with the text alignment, location, and options.
- (id)initWithTextAlignment:(NSTextAlignment)alignment location:(CGFloat)loc options:(NSDictionary *)options
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
NSParagraphStyle.hInitializes a newly allocated NSTextTab with an alignment of type at location on the paragraph.
- (id)initWithType:(NSTextTabType)type location:(CGFloat)location
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.
NSParagraphStyle.hReturns the receiver’s ruler location relative to the back margin.
- (CGFloat)location
The receiver’s ruler location relative to the back margin.
NSParagraphStyle.hReturns the dictionary of attributes associated with the receiver.
- (NSDictionary *)options
The dictionary of attributes associated with the receiver.
NSParagraphStyle.hReturns the receiver’s tab stop type.
- (NSTextTabType)tabStopType
The receiver’s tab stop type. Possible values are listed in NSTextTabType.
NSParagraphStyle.hThese constants describe the various type of tab stop.
typedef enum _NSTextTabType { NSLeftTabStopType = 0, NSRightTabStopType, NSCenterTabStopType, NSDecimalTabStopType } NSTextTabType;
NSLeftTabStopTypeA left-aligned tab stop.
Available in Mac OS X v10.0 and later.
Declared in NSParagraphStyle.h.
NSRightTabStopTypeA right-aligned tab stop.
Available in Mac OS X v10.0 and later.
Declared in NSParagraphStyle.h.
NSCenterTabStopTypeA center-aligned tab stop.
Available in Mac OS X v10.0 and later.
Declared in NSParagraphStyle.h.
NSDecimalTabStopTypeAligns columns of numbers by the decimal point.
Available in Mac OS X v10.0 and later.
Declared in NSParagraphStyle.h.
The following mappings define the conversions between text alignment in NSTextTab and tab stop types defined by NSTextTab:
Alignment |
Tab Stop Type |
|---|---|
|
|
|
NSParagraphStyle.hThis constant specifies the terminating character for a tab column.
NSString *NSTabColumnTerminatorsAttributeName;
NSTabColumnTerminatorsAttributeNameThe 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 Mac OS X v10.3 and later.
Declared in NSParagraphStyle.h.
NSParagraphStyle.hLast updated: 2006-05-23