呈现游戏中心问题
我正在尝试在游戏中添加高分,但我不知道为什么无法显示排行榜。我可以连接用户并发送数据。但看不到它。
我的游戏是在 Cocos2d 中的。但当用户单击“播放 CCDirector 开始”时,我的菜单不存在。
我的主窗口结构如下: -导航控制器 - 菜单 -Ui 视图控制器 - 导航项目
我尝试像导航一样进行操作并推动它并崩溃。还将其添加为子视图。和崩溃。我的排行榜代码
- (IBAction)showLeader:(id)sender {
if ([self isGameCenterAvailable]) {
GKLeaderboardViewController *leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
if (leaderboardController != nil) {
leaderboardController.leaderboardDelegate = self;
//[self presentModalViewController:leaderboardController animated:YES];
[self.navigationController pushViewController:leaderboardController animated:YES];
}
}
}
-(BOOL)isGameCenterAvailable {
// Check for presence of GKLocalPlayer API.
Class gcClass = (NSClassFromString(@"GKLocalPlayer"));
// The device must be running running iOS 4.1 or later.
NSString *reqSysVer = @"4.1";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
BOOL osVersionSupported = ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending);
return (gcClass && osVersionSupported);
}
我能做什么?
还有一个问题。我可以用自己的效果来呈现领导者分数吗?还是苹果会拒绝呢?
我正在尝试做一个小框架。所以我不需要在菜单游戏等中编码分配。
谢谢:D
I am trying to add High Scores in my game, and I don't know why i can't present the Leader boards. I can connect the user and send data. But can't see it.
My Game its in Cocos2d. But my MENU isn't when the user click on Play CCDirector Start
My main windows structure its:
-Navigation Contoller
- Menu -Ui View controller
- Navigation Item
I try to do it like a navigation and push it and crash. Also add it as subview. And crash. My leader boards code
- (IBAction)showLeader:(id)sender {
if ([self isGameCenterAvailable]) {
GKLeaderboardViewController *leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
if (leaderboardController != nil) {
leaderboardController.leaderboardDelegate = self;
//[self presentModalViewController:leaderboardController animated:YES];
[self.navigationController pushViewController:leaderboardController animated:YES];
}
}
}
-(BOOL)isGameCenterAvailable {
// Check for presence of GKLocalPlayer API.
Class gcClass = (NSClassFromString(@"GKLocalPlayer"));
// The device must be running running iOS 4.1 or later.
NSString *reqSysVer = @"4.1";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
BOOL osVersionSupported = ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending);
return (gcClass && osVersionSupported);
}
What could i do?
And another question. Could i put my own effect to present the leader bords scores? Or apple will reject it?
I am trying to do a small framework. So i don't need to codify allot in the Menu Game etc..
Thanks :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了如何做到这一点。
menu2Game 它是一个干净的视图控制器。也许我可以在这里暂时创建一个视图控制器。但我需要将其保存在某处,以便我可以将其忽略。
它起作用了。但我想在风景中做到这一点
I found how to do this.
menu2Game its a clean View Controller. Maybe I can create a view controller temporally here. But I need to save it somewhere so i could dismiss it.
It work. But i am trying to do it in a landscape