- Inherits from:
- NSObject
- Conforms to:
- NSCoding
- NSObject (NSObject)
Declared in:
- AppKit/NSTabViewItem.h
Note: The NSTabView class and its supporting class NSTabViewItem are under development. If you want to use these classes, you will have to instantiate them programmatically because Interface Builder does not yet include support for them. |
An NSTabView provides a convenient mechanism for presenting information in a multi-page format. A tab view is usually distinguished by a row of tabs that give the visual appearance of folder tabs. When the user clicks on a tab, the tab view displays a view page provided by your application.
A tab view keeps a zero-based array of NSTabViewItems, one for each tab in the view. A tab view item provides access to the tab's color, state, label text, initial first responder, and associated view. Your application can supply each tab view item with an optional identifier object to customize tab handling.
- Creating a tab view item
- - initWithIdentifier:
- Working with labels
- - drawLabel:inRect:
- - label
- - setLabel:
- - sizeOfLabel:
- Checking the tab display state
- - tabState
- Assigning an identifier object
- - identifier
- - setIdentifier:
- Setting the color
- - color
- - setColor:
- Assigning a view
- - view
- - setView:
- Setting the initial first responder
- - initialFirstResponder
- - setInitialFirstResponder:
- Accessing the parent tab view
- - tabView
- (NSColor *)color
See Also: - setColor:
- (void)drawLabel:(BOOL)shouldTruncateLabel
inRect:(NSRect)tabRect
NO
,
draws the full label in the rect specified by tabRect.
If shouldTruncateLabel is YES
,
draws the truncated label. You can override this method to perform
customized label drawing. For example, you might want to add an icon
to each tab in the view.See Also: - sizeOfLabel:
- (id)identifier
See Also: - initWithIdentifier:, - setIdentifier:
- (id)initialFirstResponder
See Also: - setInitialFirstResponder:
- (id)initWithIdentifier:(id)identifier
nil
. Use this method
when creating tab view items programmatically.See Also: - identifier, - setIdentifier:
- (NSString *)label
See Also: - setLabel:
- (void)setColor:(NSColor
*)color
See Also: - color
- (void)setIdentifier:(id)identifier
See Also: - identifier, - initWithIdentifier:
- (void)setInitialFirstResponder:(NSView
*)view
See Also: - initialFirstResponder
- (void)setLabel:(NSString
*)label
See Also: - label
- (void)setView:(NSView
*)view
See Also: - view
- (NSSize)sizeOfLabel:(BOOL)shouldTruncateLabel
NO
,
returns the size of the tab view item's full label. If shouldTruncateLabel is YES
,
returns the truncated size. If your application does anything to
change the size of tab labels, such as overriding the drawLabel:inRect: method
to add an icon to each tab, you should override sizeOfLabel: too so the NSTabView
knows the correct size for the tab label.See Also: - drawLabel:inRect:, - setFont: (NSTabView)
- (NSTabState)tabState
NSSelectedTab
, NSBackgroundTab
,
or NSPressedTab
. Your application
does not directly set the tab state.- (NSTabView *)tabView
A tab view item normally learns about its parent tab view when it is inserted into the view's array of items. The NSTabView methods addTabViewItem: and insertTabViewItem:atIndex: set the tab view for the added or inserted item.
See Also: - setView:, - view
- (id)view
See Also: - setView: