2012-10-08 46 views
2

我是一個初學者,使用Kobold2d v2.0.4,我創建的遊戲僅針對iOS 6,並且設計爲僅在橫向方向上運行,並且當我實施遊戲中心我發現iOS 6上的遊戲中心登錄只能在肖像上運行,所以我搜索並找到了解決方案,但問題是我無法找到將它們放入Kobold2d的位置。 添加到您的RootViewController的遊戲中心登錄畫像只爲Kobold2d提供任何解決方案

-(NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAllButUpsideDown; 
} 

-(BOOL)shouldAutorotate { 
    return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait; 
} 

我不得不嘗試尋找KKRootViewController,但我能找到的,我只是想知道其他開發商Kobold2d如何找到解決這個問題的解決方案。如果你不介意你能不能告訴我你如何解決它。 謝謝你。

回答

0

我還沒有自己測試過,我認爲如果你把這段代碼放到你項目的AppDelegate類中,它可能會工作。如果沒有,您可能必須使用這些方法創建一個類別,或者在KKRootViewController或CCDirector上。

+0

非常感謝您的建議,這是一種榮幸,讓你回答我的問題,這實際上是一個驚喜,我愛你的工作,我的意思是本書,博客,kobold2d,無論如何,再次感謝你 -^___ _^- –

0

實際上我的工作是在應用程序摘要中選擇縱向和橫向方向,然後在UINavigationController上創建一個類別,因爲Kobold2D在窗口上使用導航控制器作爲rootViewController。

@implementation UINavigationController (GameCenter) 

-(NSUInteger)supportedInterfaceOrientations { 
    return UIInterfaceOrientationMaskAllButUpsideDown; 
} 

-(BOOL)shouldAutorotate { 
    return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait; 
} 

@end 

然後將其導入AppDelegate.m文件。 感謝您的想法反正...