游戏中心问题

时间:2014-12-13 21:28:20

标签: game-center

Im New In Development思考,我想知道一些事情,如游戏中心按钮,如何连接该按钮是否有任何现成的代码,关于率按钮的相同问题。任何人都可以告诉我如何做到这一点

1 个答案:

答案 0 :(得分:-1)

//Rate Button

if ([node.name isEqualToString:@"rateButton"]) //Your Rate Button name
    {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id919770861"]];//itms-apps://itunes.apple.com/app/idYourAppID
    }


//Game Center Button

 - (void)showGKGameCenterViewController:
(UIViewController *)viewController
{
    if (!_enableGameCenter) {
        NSLog(@"Local play is not authenticated");
    }
    GKGameCenterViewController *gameCenterViewController =
    [[GKGameCenterViewController alloc] init];
    gameCenterViewController.gameCenterDelegate = self;
    gameCenterViewController.viewState =
    GKGameCenterViewControllerStateAchievements;
    [viewController presentViewController:gameCenterViewController
                                 animated:YES
                               completion:nil];
}

if ([node.name isEqualToString:@"GameCenter"]) //Your Game Center Button Name
        {
            [self showGKGameCenterViewController:yourViewController];
        }