Mac Developer Library

Developer

GameKit Framework Reference GKDialogController Class Reference

Options
Deployment Target:

On This Page
Language:

GKDialogController

The GKDialogController class provides the ability to present Game Center view controller classes on OS X. iOS games present the view controllers using the normal presentation methods provided by the UIViewController class. More...

Inheritance


Conforms To


Import Statement


import GameKit @import GameKit;

Availability


Available in OS X v10.8 and later.
  • Retrieves the shared instance of the dialog controller.

    Declaration

    Swift

    class func sharedDialogController() -> GKDialogController!

    Objective-C

    + (GKDialogController *)sharedDialogController

    Return Value

    The shared dialog controller.

    Discussion

    Game Kit provides the shared dialog controller as a convenience. Your game can either use the shared dialog controller provided by this method, or it can instantiate its own GKDialogController object and configure it. You might create multiple GKDialogController objects when each should be presented in its own window.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.8 and later.

  • The window that view controllers presented by the dialog controller are displayed in.

    Declaration

    Swift

    @IBOutlet unowned(unsafe) var parentWindow: NSWindow!

    Objective-C

    @property(assign) IBOutlet NSWindow *parentWindow

    Discussion

    Your app must set this property before presenting a view controller. The window must be at least 800 x 600.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.8 and later.

  • Presents a view controller in the dialog controller’s window.

    Declaration

    Swift

    func presentViewController(_ viewController: NSViewController!) -> Bool

    Objective-C

    - (BOOL)presentViewController:(NSViewController<GKViewController> *)viewController

    Parameters

    viewController

    A Game Center view controller.

    Return Value

    YEStrue if the view controller was presented, NOfalse if an error occurred.

    Discussion

    The contents of the window are covered by the view controller’s contents until the view controller is dismissed.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.8 and later.

    See Also

    – dismiss:

  • Dismisses the currently displayed view controller.

    Declaration

    Swift

    @IBAction func dismiss(_ sender: AnyObject!)

    Objective-C

    - (IBAction)dismiss:(id)sender

    Parameters

    sender

    The object that is dismissing the view controller.

    Import Statement

    import GameKit

    Availability

    Available in OS X v10.8 and later.