Mac Developer Library

Developer

AppKit Framework Reference NSTabView Class Reference

Options
Deployment Target:

On This Page
Language:

NSTabView

An NSTabView object provides a convenient way to present information in multiple pages. The view contains a row of tabs that give the appearance of folder tabs, as shown in the following figure. The user selects the desired page by clicking the appropriate tab or using the arrow keys to move between pages. Each page displays a view hierarchy provided by your application. More...

Inheritance


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.0 and later.
  • This action method selects the first tab view item.

    Declaration

    Swift

    func selectFirstTabViewItem(_ sender: AnyObject?)

    Objective-C

    - (void)selectFirstTabViewItem:(id)sender

    Parameters

    sender

    Typically the object that sent invoked the message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • This action method selects the last tab view item.

    Declaration

    Swift

    func selectLastTabViewItem(_ sender: AnyObject?)

    Objective-C

    - (void)selectLastTabViewItem:(id)sender

    Parameters

    sender

    Typically the object that sent invoked the message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • This action method selects the next tab view item in the sequence.

    Declaration

    Swift

    func selectNextTabViewItem(_ sender: AnyObject?)

    Objective-C

    - (void)selectNextTabViewItem:(id)sender

    Parameters

    sender

    Typically the object that sent invoked the message.

    Discussion

    If the currently visible item is the last item in the sequence, this method does nothing, and the last page remains displayed.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • This action method selects the previous tab view item in the sequence.

    Declaration

    Swift

    func selectPreviousTabViewItem(_ sender: AnyObject?)

    Objective-C

    - (void)selectPreviousTabViewItem:(id)sender

    Parameters

    sender

    Typically the object that sent invoked the message.

    Discussion

    If the currently visible item is the first item in the sequence, this method does nothing, and the first page remains displayed.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Selects the specified tab view item.

    Declaration

    Swift

    func selectTabViewItem(_ tabViewItem: NSTabViewItem?)

    Objective-C

    - (void)selectTabViewItem:(NSTabViewItem *)tabViewItem

    Parameters

    tabViewItem

    The tab item to select.

    Discussion

    If there is a delegate and the delegate supports it, sends the delegate the tabView:shouldSelectTabViewItem: message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Selects the tab view item specified by index.

    Declaration

    Swift

    func selectTabViewItemAtIndex(_ index: Int)

    Objective-C

    - (void)selectTabViewItemAtIndex:(NSInteger)index

    Parameters

    index

    The index of the tab item to selected.

    Discussion

    The index parameter is base 0. If there is a delegate and the delegate supports it, sends the delegate the tabView:shouldSelectTabViewItem: message.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Selects the tab view item specified by identifier.

    Declaration

    Swift

    func selectTabViewItemWithIdentifier(_ identifier: AnyObject)

    Objective-C

    - (void)selectTabViewItemWithIdentifier:(id)identifier

    Parameters

    identifier

    The identifier of the tab item to select.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the tab view item for the currently selected tab

    Declaration

    Swift

    var selectedTabViewItem: NSTabViewItem? { get }

    Objective-C

    @property(readonly, strong) NSTabViewItem *selectedTabViewItem

    Return Value

    The currently selected tab view item, or nil if no item is selected.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the selected tab view item to the selected item obtained from the sender.

    Declaration

    Swift

    func takeSelectedTabViewItemFromSender(_ sender: AnyObject?)

    Objective-C

    - (void)takeSelectedTabViewItemFromSender:(id)sender

    Parameters

    sender

    Typically the object that sent invoked the message.

    Discussion

    If sender responds to the indexOfSelectedItem method, this method invokes that method and selects the tab view item at the specified index.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the font for tab label text.

    Declaration

    Swift

    var font: NSFont

    Objective-C

    @property(strong) NSFont *font

    Return Value

    Returns the tab view label font.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setFont:

  • Sets the font for tab label text to font.

    Declaration

    Swift

    var font: NSFont

    Objective-C

    @property(strong) NSFont *font

    Parameters

    font

    The font to use as the tab view label font.

    Discussion

    Tab height is adjusted automatically to accommodate a new font size. If the view allows truncating, tab labels are truncated as needed.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the tab type to tabViewType.

    Declaration

    Swift

    var tabViewType: NSTabViewType

    Objective-C

    @property NSTabViewType tabViewType

    Parameters

    tabViewType

    The tab type to display the tabs. The supported values are listed in NSTabViewType

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – tabViewType

  • Returns the tab type for the receiver.

    Declaration

    Swift

    var tabViewType: NSTabViewType

    Objective-C

    @property NSTabViewType tabViewType

    Return Value

    The tab type to display the tabs. The supported values are listed in NSTabViewType

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the receiver’s control tint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Return Value

    The tab view’s control tint. See NSControlTint for the supported values.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s control tint to controlTint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Parameters

    controlTint

    The tab view’s control tint. See NSControlTint for the supported values.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlTint

  • Returns whether if the receiver draws a background color when the tab view type is NSNoTabsNoBorder.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Return Value

    YEStrue if the receiver draws a background color when the tab view type is NSNoTabsNoBorder, otherwise NOfalse.

    Discussion

    If the receiver uses bezeled edges or a line border, the appropriate background color for that border is used.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether a background is drawn when the view type is NSNoTabsNoBorder to flag.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Parameters

    flag

    YEStrue if the background should be drawn, otherwise NOfalse.

    Discussion

    If the receiver has a bezeled border or a line border, the appropriate background for that border is used.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the minimum size necessary for the receiver to display tabs in a useful way.

    Declaration

    Swift

    var minimumSize: NSSize { get }

    Objective-C

    @property(readonly) NSSize minimumSize

    Return Value

    The minimum size necessary for the receiver to display tabs in a useful way.

    Discussion

    You can use the value returned by this method to limit how much a user can resize a tab view.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the rectangle describing the content area of the receiver.

    Declaration

    Swift

    var contentRect: NSRect { get }

    Objective-C

    @property(readonly) NSRect contentRect

    Return Value

    Returns the rectangle describing the content area of the receiver.

    Discussion

    This area does not include the space required for the receiver’s tabs or borders (if any).

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the size of the receiver.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Return Value

    Valid return values are described inControl Sizes in NSCell Class Reference.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the size of the receiver to controlSize.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Parameters

    controlSize

    The size of the receiver. Valid values are described in Control Sizes in NSCell Class Reference

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – controlSize

  • Returns whether if the receiver allows truncating for labels that don’t fit on a tab.

    Declaration

    Swift

    var allowsTruncatedLabels: Bool

    Objective-C

    @property BOOL allowsTruncatedLabels

    Return Value

    YEStrue if the receiver allows truncating for labels that don’t fit on a tab, otherwise NOfalse.

    Discussion

    The default is NOfalse.

    When truncating is allowed, the tab view inserts an ellipsis, if necessary, to fit a label in the tab.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets whether the receiver allows truncating for names that don’t fit on a tab.

    Declaration

    Swift

    var allowsTruncatedLabels: Bool

    Objective-C

    @property BOOL allowsTruncatedLabels

    Parameters

    allowTruncatedLabels

    YEStrue if the receiver allows truncating for labels that don’t fit on a tab, otherwise NOfalse.

    Discussion

    The default is NOfalse.

    When truncating is allowed, the tab view inserts an ellipsis, if necessary, to fit a label in the tab.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSTabViewDelegate?

    Objective-C

    @property(assign) id<NSTabViewDelegate> delegate

    Parameters

    anObject

    The delegate object. It must conform to the NSTabViewDelegate protocol.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – delegate

  • Returns the receiver’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSTabViewDelegate?

    Objective-C

    @property(assign) id<NSTabViewDelegate> delegate

    Return Value

    The object’s delegate.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the tab view item at the specified point.

    Declaration

    Swift

    func tabViewItemAtPoint(_ point: NSPoint) -> NSTabViewItem?

    Objective-C

    - (NSTabViewItem *)tabViewItemAtPoint:(NSPoint)point

    Parameters

    point

    The hit point.

    Return Value

    The tab view item under the hit point, or nil if no tab view item is under that location.

    Discussion

    You can use this method to find a tab view item based on a user’s mouse click.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify the tab view’s type as used by tabViewType and setTabViewType:.

    Declaration

    Swift

    enum NSTabViewType : UInt { case TopTabsBezelBorder case LeftTabsBezelBorder case BottomTabsBezelBorder case RightTabsBezelBorder case NoTabsBezelBorder case NoTabsLineBorder case NoTabsNoBorder }

    Objective-C

    enum { NSTopTabsBezelBorder = 0, NSLeftTabsBezelBorder = 1, NSBottomTabsBezelBorder = 2, NSRightTabsBezelBorder = 3, NSNoTabsBezelBorder = 4, NSNoTabsLineBorder = 5, NSNoTabsNoBorder = 6 }; typedef NSUInteger NSTabViewType;

    Constants

    • TopTabsBezelBorder

      NSTopTabsBezelBorder

      The view includes tabs on the top of the view and has a bezeled border (the default).

      Available in OS X v10.0 and later.

    • NoTabsBezelBorder

      NSNoTabsBezelBorder

      The view does not include tabs and has a bezeled border.

      Available in OS X v10.0 and later.

    • NoTabsLineBorder

      NSNoTabsLineBorder

      The view does not include tabs and has a lined border.

      Available in OS X v10.0 and later.

    • NoTabsNoBorder

      NSNoTabsNoBorder

      The view does not include tabs and has no border.

      Available in OS X v10.0 and later.

    • BottomTabsBezelBorder

      NSBottomTabsBezelBorder

      Tabs are on the bottom of the view with a bezeled border.

      Available in OS X v10.0 and later.

    • LeftTabsBezelBorder

      NSLeftTabsBezelBorder

      Tabs are on the left of the view with a bezeled border.

      Available in OS X v10.0 and later.

    • RightTabsBezelBorder

      NSRightTabsBezelBorder

      Tabs are on the right of the view with a bezeled border.

      Available in OS X v10.0 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • This constant specifies the minimum version of the Application Kit that supports directional tabs.

    Declaration

    Swift

    var NSAppKitVersionNumberWithDirectionalTabs: Double { get }

    Objective-C

    #define NSAppKitVersionNumberWithDirectionalTabs 631.0

    Constants

    • NSAppKitVersionNumberWithDirectionalTabs

      NSAppKitVersionNumberWithDirectionalTabs

      The specific version of the AppKit framework that introduced support for directional tab items. Developers should not need to use this constant unless they are writing applications for OS X v10.1 and earlier.

      Available in OS X v10.2 and later.

    Import Statement