我正在尝试将游戏中心集成到我的应用程序中。它在 iPad 上运行良好,但在 iPhone 上,游戏中心视图部分显示,方向错误。见:http ://cl.ly/image/2b241H210T3E
这是我如何称呼视图:
GKLeaderboardViewController *lb = [[GKLeaderboardViewController alloc] init];
if (lb != nil) {
lb.category = [NSString stringWithFormat:@"%@_overall", [AppSettings appleGameCenterId]];
lb.leaderboardDelegate = self;
[self presentModalViewController:lb animated:YES];
}
[lb release];
我还尝试像这样子类 GKLeaderboardViewController:
。H:
@interface ITGKLeaderboardViewController : GKLeaderboardViewController
@end
米:
@interface ITGKLeaderboardViewController ()
@end
@implementation ITGKLeaderboardViewController
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
@end
但这仍然是相同的结果。
任何的想法 ?谢谢你的帮助 !