Mac Developer Library

Developer

AppKit Framework Reference NSTabView Class Reference

Options
Deployment Target:

On This Page
Language:

NSTabView

Inheritance


Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.

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.

image: ../Art/tabview_2x.png
  • 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 the message.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    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

    Objective-C

    @import AppKit;

    Swift

    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 the message.

    Discussion

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    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 the message.

    Discussion

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    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

    Objective-C

    @import AppKit;

    Swift

    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

    Objective-C

    @import AppKit;

    Swift

    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

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • The tab view item for the currently selected tab. (read-only)

    Declaration

    Swift

    var selectedTabViewItem: NSTabViewItem? { get }

    Objective-C

    @property(readonly, strong) NSTabViewItem *selectedTabViewItem

    Discussion

    If no item is selected, the value of this property is nil.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    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 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

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • font font Property

    The font used for the tab view’s label text.

    Declaration

    Swift

    var font: NSFont

    Objective-C

    @property(strong) NSFont *font

    Discussion

    The default value of this property is the message font of default size (see messageFontOfSize:), which is equivalent to the system font of default size. Tab height is adjusted automatically to accommodate a new font size. If the view allows truncating, tab labels are truncated as needed.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • The tab type to display the tabs.

    Declaration

    Swift

    var tabViewType: NSTabViewType

    Objective-C

    @property NSTabViewType tabViewType

    Discussion

    The supported values for this property are listed in NSTabViewType. The default value of this property is NSTopTabsBezelBorder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • The tab view’s control tint.

    Declaration

    Swift

    var controlTint: NSControlTint

    Objective-C

    @property NSControlTint controlTint

    Discussion

    The valid values for this property are described in NSControlTint. The default value of this property is NSDefaultControlTint.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • A Boolean value that indicates if the tab view draws a background color when its type is NSNoTabsNoBorder.

    Declaration

    Swift

    var drawsBackground: Bool

    Objective-C

    @property BOOL drawsBackground

    Discussion

    When the value of this property is YEStrue, the tab view draws a background color when the its type is NSNoTabsNoBorder, otherwise it does not. If the tab view has a bezeled border or a line border, the appropriate background for that border is used. The default value of this property is YEStrue.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    tabViewType

  • The minimum size necessary for the tab view to display tabs in a useful way. (read-only)

    Declaration

    Swift

    var minimumSize: NSSize { get }

    Objective-C

    @property(readonly) NSSize minimumSize

    Discussion

    You can use the value of this property to limit how much a user can resize a tab view.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    tabViewType

  • The rectangle describing the content area of the tab view. (read-only)

    Declaration

    Swift

    var contentRect: NSRect { get }

    Objective-C

    @property(readonly) NSRect contentRect

    Discussion

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • The size of the tab view.

    Declaration

    Swift

    var controlSize: NSControlSize

    Objective-C

    @property NSControlSize controlSize

    Discussion

    The valid values for this property are described inControl Sizes in NSCell Class Reference. The default value of this property is NSRegularControlSize.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • A Boolean value that indicates if the tab view allows truncating for labels that don’t fit on a tab.

    Declaration

    Swift

    var allowsTruncatedLabels: Bool

    Objective-C

    @property BOOL allowsTruncatedLabels

    Discussion

    When the value of this property is YEStrue, the tab view allows truncating for labels that don’t fit on a tab, otherwise it does not. The default value is YEStrue. When truncating is allowed, the tab view inserts an ellipsis, if necessary, to fit a label in the tab.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • delegate delegate Property

    The tab view’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: NSTabViewDelegate?

    Objective-C

    @property(assign) id< NSTabViewDelegate > delegate

    Discussion

    The value of this property must conform to the NSTabViewDelegate protocol.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    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

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • These constants specify the tab view’s type as used by the tabViewType property.

    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

    Objective-C

    @import AppKit;

    Swift

    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.

      Available in OS X v10.2 and later.