[英]don't know what I have to do to add Game Center leaderboard
I tried to add a Game Center leaderboard, first setting it on iTunes Connect but when I have to write the code in Xcode I don't know what I have to do. 我试图添加一个Game Center排行榜,首先在iTunes Connect上进行设置,但是当我不得不用Xcode编写代码时,我不知道该怎么做。 I want to open the leaderboard with a shake gesture and for that I will use this code in the ViewController.m file:
我想用手势打开排行榜,为此,我将在ViewController.m文件中使用以下代码:
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype == UIEventSubtypeMotionShake) {
// Code you want to run when the shake began
}
}
Is that code right? 该代码正确吗? And please can anyone help me what I have to do for appear the leaderboard when shaking?
而且,请问有人可以帮我晃动时出现排行榜吗?
GKGameCenterViewController
instance GKGameCenterViewController
实例 viewState
property viewState
属性 gameCenterDelegate
property gameCenterDelegate
属性 Present the VC: 展示VC:
GKGameCenterViewController *vc = [GKGameCenterViewController new]; vc.viewState = GKGameCenterViewControllerStateLeaderboards; vc.gameCenterDelegate = self; [self presentViewController:vc animated:YES];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.