iOS Developer Library

Developer

GameKit Framework Reference GKNotificationBanner Class Reference

Options
Deployment Target:

On This Page
Language:

GKNotificationBanner

Inheritance


Conforms To


Import Statement


Swift

import GameKit

Objective-C

@import GameKit;

Availability


Available in iOS 5.0 and later.

The GKNotificationBanner class allows your game to display a notification banner that displays text to the player. The behavior of this banner is identical to other banners used by Game Kit.

  • Displays a banner to the player.

    Declaration

    Swift

    class func showBannerWithTitle(_ title: String!, message message: String!, completionHandler completionHandler: (() -> Void)!)

    Objective-C

    + (void)showBannerWithTitle:(NSString *)title message:(NSString *)message completionHandler:(void (^)(void))completionHandler

    Parameters

    title

    The title of the banner.

    message

    A secondary message to be displayed.

    completionHandler

    A block to be called after the score is reported.

    Discussion

    When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in iOS 5.0 and later.

  • Displays a banner to the player for a specified period of time.

    Declaration

    Swift

    class func showBannerWithTitle(_ title: String!, message message: String!, duration duration: NSTimeInterval, completionHandler completionHandler: (() -> Void)!)

    Objective-C

    + (void)showBannerWithTitle:(NSString *)title message:(NSString *)message duration:(NSTimeInterval)duration completionHandler:(void (^)(void))completionHandler

    Parameters

    title

    The title of the banner.

    message

    A secondary message to be displayed.

    duration

    The amount of time that the banner should be displayed to the player.

    completionHandler

    A block to be called after the score is reported.

    Discussion

    When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

    Import Statement

    Objective-C

    @import GameKit;

    Swift

    import GameKit

    Availability

    Available in iOS 6.0 and later.