Mac Developer Library

Developer

AppKit Framework Reference NSDockTile Class Reference

Options
Deployment Target:

On This Page
Language:

NSDockTile

The NSDockTile class lets you customize the visual representation for your application’s miniaturized windows and application icon as they appear in the Dock. You do not create Dock tile objects explicitly in your application. Instead, you retrieve the Dock tile for an existing window or for the application by calling that object’s dockTile method.

Typically, you do not subclass the NSDockTile class. Instead, you use the methods of the class to make the following customizations:

  • Badge the tile with a custom string.

  • Remove or show the application icon badge.

  • Draw the tile content yourself.

If you decide to draw the tile content yourself, you must provide a custom content view to handle the drawing.

Application Dock Tiles

An application Dock tile defaults to display the application’s applicationIconImage.

The application Dock tile never shows a smaller application icon badge.

Whether using the default or custom view, the application Dock tile may be badged with a short custom string.

Window Dock Tiles

A window Dock tile defaults to display a miniaturized version of the windows contents with a badge derived from the application Dock icon, including any customized application Dock icon. The default window Dock tile image may not be badged with a custom string.

A window Dock tile can use a custom view to draw the Dock icon. If a custom view is used, no application badge will be added, but the text label will be overlaid on top of the icon.

  • The view to use for drawing the dock tile contents.

    Declaration

    Swift

    var contentView: NSView?

    Objective-C

    @property(strong) NSView *contentView

    Discussion

    The view you specify should be height and width resizable.

    Cocoa does not automatically redraw the contents of your dock tile. Instead, your application must explicitly send display messages to the dock tile object whenever the contents of your view change and need to be redrawn. Your dock tile view is responsible for drawing the entire contents of the dock tile. Your view does not need to draw the application or custom string badges.

    Availability

    Available in OS X v10.5 and later.

    See Also

    – display

  • size size Property

    The size of the tile. (read-only)

    Declaration

    Swift

    var size: NSSize { get }

    Objective-C

    @property(readonly) NSSize size

    Discussion

    This corresponds to the size of the backing store in the dock, which may be bigger than the actual tile displayed on the screen.

    Availability

    Available in OS X v10.5 and later.

  • The object represented by the dock tile. (read-only)

    Declaration

    Swift

    unowned(unsafe) var owner: AnyObject { get }

    Objective-C

    @property(readonly, assign) id owner

    Availability

    Available in OS X v10.5 and later.

  • A boolean showing whether the tile is badged with the application’s icon

    Declaration

    Swift

    var showsApplicationBadge: Bool

    Objective-C

    @property BOOL showsApplicationBadge

    Discussion

    Miniaturized windows include the application badge by default to convey the associated application to the user. In OS X v10.5 and later, application tiles do not support the application badge. A miniaturized window with a custom view does not draw the application badge.

    The application icon is positioned automatically in the tile by the NSDockTile object.

    Availability

    Available in OS X v10.5 and later.

  • The string to be displayed in the tile’s badging area.

    Declaration

    Swift

    var badgeLabel: String?

    Objective-C

    @property(copy) NSString *badgeLabel

    Discussion

    The appearance of the badge area is system defined.

    Availability

    Available in OS X v10.5 and later.

  • Redraws the dock tile’s content.

    Declaration

    Swift

    func display()

    Objective-C

    - (void)display

    Discussion

    If a custom content view is provided, Cocoa calls the drawRect: method of that view (and its subviews) to draw the tile’s content.

    You can call this method to force the redrawing of the dock tile contents. You might do this if the contents of the underlying application or window change in a way that would require a refreshing of the tile. Some types of system activity, such as resizing the dock, may trigger automatic redraws of the tile. In most cases, however, your application is responsible for triggering redraws.

    Cocoa does not automatically redraw the contents of your dock tile. Instead, your application must explicitly send display messages to the dock tile object whenever the contents of your view change and need to be redrawn.

    Availability

    Available in OS X v10.5 and later.

  • The version of the AppKit framework containing support for dock tile plug-ins.

    Declaration

    Swift

    var NSAppKitVersionNumberWithDockTilePlugInSupport: Double { get }

    Objective-C

    #define NSAppKitVersionNumberWithDockTilePlugInSupport 1001.0

    Constants

    • NSAppKitVersionNumberWithDockTilePlugInSupport

      NSAppKitVersionNumberWithDockTilePlugInSupport

      The specific version of the AppKit framework that introduced support for dock tile plug-ins.. Developers should not need to use this constant unless they are writing applications for OS X v10.5 and earlier.

      Available in OS X v10.6 and later.