GKDialogController Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/GameKit.framework
Availability
Available in OS X v10.8 and later.
Companion guide
Declared in
GKDialogController.h

Overview

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.

To present a view controller, instantiate a new GKDialogController object or use the singleton object provided by the sharedDialogController class method. Set the parentWindow property of the dialog controller to the window that should display the view controller’s contents. Then, call the dialog controller’s presentViewController: method, passing in the view controller object to be presented. Later, when the view controller’s contents should be hidden, call the dialog controller’s dismiss: method.

Tasks

Accessing the Shared Dialog Controller

Setting the Presentation Window

Presenting and Dismissing the Dialog

Properties

parentWindow

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

@property(nonatomic, assign) NSWindow *parentWindow
Discussion

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

Availability
  • Available in OS X v10.8 and later.
Declared In
GKDialogController.h

Class Methods

sharedDialogController

Retrieves the shared instance of the dialog controller.

+ (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.

Availability
  • Available in OS X v10.8 and later.
Declared In
GKDialogController.h

Instance Methods

dismiss:

Dismisses the currently displayed view controller.

- (void)dismiss:(id)sender
Parameters
sender

The object that is dismissing the view controller.

Availability
  • Available in OS X v10.8 and later.
Declared In
GKDialogController.h

presentViewController:

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

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

A Game Center view controller.

Return Value

YES if the view controller was presented, NO if an error occurred.

Discussion

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

Availability
  • Available in OS X v10.8 and later.
See Also
Declared In
GKDialogController.h