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.

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

    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.

    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.

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

    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.

    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.

    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.

    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.