我是使用Kobold2d v2.0.4的初学者,我正在创建的游戏仅针对iOS 6,并且设计仅在横向方向上运行,当我实施游戏中心时,我发现游戏中心在iOS 6上登录只能在肖像上运行,所以我搜索并找到解决方案,但问题是我找不到将它们放在Kobold2d中的位置。 将其添加到RootViewController
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
-(BOOL)shouldAutorotate {
return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait;
}
我曾尝试寻找KKRootViewController但我能找到,我只是想知道其他Kobold2d开发人员如何找到解决这个问题的解决方案。如果您不介意,请告诉我您如何解决它。 谢谢你。
答案 0 :(得分:0)
我自己没有测试过,我认为如果将此代码放在项目的AppDelegate类中可能会有效。如果没有,您可能必须使用这些方法创建一个类别,可以在KKRootViewController或CCDirector上创建。
答案 1 :(得分:0)
实际上对我有用的是在app摘要中选择纵向和横向,然后在UINavigationController上创建一个类别,因为Kobold2D在窗口上使用导航控制器作为rootViewController。
@implementation UINavigationController (GameCenter)
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
-(BOOL)shouldAutorotate {
return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait;
}
@end
将其导入AppDelegate.m文件。 不管怎样,谢谢你的想法...