Mac Developer Library

Developer

QLPreviewPanel Class Reference

Options
Deployment Target:

On This Page
Language:

QLPreviewPanel

The QLPreviewPanel class implements the Quick Look preview panel—a user interface object that displays the preview of a list of items.

Every application has a single shared instance of QLPreviewPanel (see sharedPreviewPanelExists). The preview panel follows the responder chain and adapts to the first responder willing to control it. A preview panel controller provides the content through methods defined in the QLPreviewPanelDataSource protocol.

You can not subclass QLPreviewPanel; you can, however, customize its behavior using a delegate (see delegate and the QLPreviewPanelDelegate Protocol informal protocol).

Inheritance


Import Statement


Swift

import Quartz

Objective-C

@import Quartz;

Availability


Available in OS X v10.6 and later.
  • Returns the shared Quick Look preview panel instance.

    Declaration

    Swift

    class func sharedPreviewPanel() -> QLPreviewPanel!

    Objective-C

    + (QLPreviewPanel *)sharedPreviewPanel

    Return Value

    The shared Quick Look preview panel instance for the application.

    Discussion

    This method creates the panel if it doesn’t exist yet. Use sharedPreviewPanelExists if you want to determine whether the panel exists without creating it.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Returns a Boolean value that indicates whether the shared Quick Look preview panel instance has been created.

    Declaration

    Swift

    class func sharedPreviewPanelExists() -> Bool

    Objective-C

    + (BOOL)sharedPreviewPanelExists

    Return Value

    YEStrue if the shared Quick Look preview panel instance has been created, otherwise NOfalse.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • The current first responder accepting to control the preview panel.

    Declaration

    Swift

    var currentController: AnyObject! { get }

    Objective-C

    @property(readonly) id currentController

    Discussion

    You should never change the preview panel’s state (its delegate, datasource, and so on) if you are not controlling it.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Asks the preview panel to update its current controller.

    Declaration

    Swift

    func updateController()

    Objective-C

    - (void)updateController

    Discussion

    The preview panel automatically updates its controller (by searching the responder chain) whenever the main or key window changes. You should only invoke this method if the responder chain changes without explicit notice.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • The preview panel data source.

    Declaration

    Swift

    unowned(unsafe) var dataSource: QLPreviewPanelDataSource!

    Objective-C

    @property(assign) id< QLPreviewPanelDataSource > dataSource

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Asks the preview panel to reload its data from its data source.

    Declaration

    Swift

    func reloadData()

    Objective-C

    - (void)reloadData

    Discussion

    This method does not refresh the visible item if it has not changed.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Asks the preview panel to recompute the preview of the current preview item.

    Declaration

    Swift

    func refreshCurrentPreviewItem()

    Objective-C

    - (void)refreshCurrentPreviewItem

    Discussion

    This method does not refresh the visible item if it has not changed.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

    See Also

    – reloadData

  • The index of the current preview item.

    Declaration

    Swift

    var currentPreviewItemIndex: Int

    Objective-C

    @property NSInteger currentPreviewItemIndex

    Discussion

    The value is NSNotFound if there is no current preview item.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • The currently previewed item.

    Declaration

    Swift

    var currentPreviewItem: QLPreviewItem! { get }

    Objective-C

    @property(readonly) id< QLPreviewItem > currentPreviewItem

    Discussion

    The value is nil if there is no current preview item.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • The preview panel’s display state.

    Declaration

    Swift

    var displayState: AnyObject!

    Objective-C

    @property(retain) id displayState

    Discussion

    The value is an opaque object—you cannot create your own display state.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • delegate delegate Property

    The preview panel’s delegate.

    Declaration

    Swift

    unowned(unsafe) var delegate: QLPreviewPanelDelegate!

    Objective-C

    @property(assign) id< QLPreviewPanelDelegate > delegate

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Instructs the panel to enter full screen mode.

    Declaration

    Swift

    func enterFullScreenMode(_ screen: NSScreen!, withOptions options: [NSObject : AnyObject]!) -> Bool

    Objective-C

    - (BOOL)enterFullScreenMode:(NSScreen *)screen withOptions:(NSDictionary *)options

    Parameters

    screen

    This parameter is not currently used—pass nil.

    options

    This parameter is not currently used—pass nil.

    Return Value

    YEStrue if the panel was able to enter full screen mode, otherwise NOfalse.

    Discussion

    If panel is not on-screen, the panel will go directly to full screen mode.

    The panel will choose the appropriate screen depending on where the panel is or, if entering fullscreen directly, where the panel is supposed to zoom from (see QLPreviewPanelDelegate Protocol).

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Instructs the panel to exit full screen mode.

    Declaration

    Swift

    func exitFullScreenModeWithOptions(_ options: [NSObject : AnyObject]!)

    Objective-C

    - (void)exitFullScreenModeWithOptions:(NSDictionary *)options

    Parameters

    options

    This parameter is not currently used—pass nil.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Indicates whether the panel is in full screen mode.

    Declaration

    Swift

    var inFullScreenMode: Bool { get }

    Objective-C

    @property(readonly, getter=isInFullScreenMode) BOOL inFullScreenMode

    Discussion

    The value is YEStrue if the panel is currently open and in full screen mode, otherwise it is NOfalse.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.