我尝试添加一个Game Center排行榜,首先在iTunes Connect上设置它,但是当我必须在Xcode中编写代码时,我不知道自己该做什么。我想用摇动手势打开排行榜,为此我将在ViewController.m文件中使用此代码:
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if(event.subtype == UIEventSubtypeMotionShake) {
// Code you want to run when the shake began
}
}
那个代码对吗? 并且请有人能帮助我在摇晃时出现在排行榜上我必须做些什么吗?
答案 0 :(得分:0)
GKGameCenterViewController
实例viewState
属性gameCenterDelegate
属性介绍VC:
GKGameCenterViewController *vc = [GKGameCenterViewController new];
vc.viewState = GKGameCenterViewControllerStateLeaderboards;
vc.gameCenterDelegate = self;
[self presentViewController:vc animated:YES];