iOS Developer Library

Developer

GameKit Framework Reference GKLeaderboardViewController Class Reference

Options
Deployment Target:

On This Page
Language:

GKLeaderboardViewController

The GKLeaderboardViewController class provides a standard user interface that displays leaderboard scores to the player. If the GKGameCenterViewController class is available, you should use it instead. More...

Import Statement


import GameKit @import GameKit;

Availability


Available in iOS 4.1 and later.
Deprecated in iOS 7.0.
  • category category Property

    The named leaderboard that is displayed by the view controller.

    Declaration

    Swift

    var category: String!

    Objective-C

    @property(copy, nonatomic) NSString *category

    Discussion

    The category property must either be nil or it must match a leaderboard identifier for a leaderboard you defined in iTunes Connect. If nil, the view displays scores for the default leaderboard. Default is nil.

    When the view controller is presented, the initial leaderboard shown is based on the value of this property. If the player changes which leaderboard they are viewing, the category property is automatically updated. For example, you can read the category property after the screen is dismissed, and set that value the next time you initialize a new leaderboard view controller.

    Import Statement

    import GameKit

    Availability

    Available in iOS 4.1 and later.

  • The view controller’s delegate.

    Declaration

    Swift

    unowned(unsafe) var leaderboardDelegate: GKLeaderboardViewControllerDelegate!

    Objective-C

    @property(assign, nonatomic) id< GKLeaderboardViewControllerDelegate > leaderboardDelegate

    Discussion

    Before displaying the leaderboard, you must set a delegate.

    Import Statement

    import GameKit

    Availability

    Available in iOS 4.1 and later.

  • timeScope timeScope Property

    A time filter used to restrict which scores are displayed to the player.

    Declaration

    Swift

    var timeScope: GKLeaderboardTimeScope

    Objective-C

    @property(assign, nonatomic) GKLeaderboardTimeScope timeScope

    Discussion

    This property determines which tab view is displayed to the player. The default value is GKLeaderboardTimeScopeAllTime, which shows the best score each player has earned. For more information on time scopes, see GKLeaderboard Class Reference.

    If the player changes which tab they view, the timeScope property is automatically updated. For example, you can read the timeScope property after the view controller is dismissed, and set that value the next time you initialize a new leaderboard view controller.

    Import Statement

    import GameKit

    Availability

    Available in iOS 4.1 and later.