0

我開始用GLSprite示例應用程序(source code),然後通過添加添加的UIViewController弄亂屏幕方向

UIViewController *vc = [[UIViewController alloc] init]; 
vc.view = glView; 
self.window.rootViewController = vc; 
[window makeKeyAndVisible]; 

GLSpriteAppDelegate::applicationDidFinishLaunching.年底控制器似乎是爲工作,現在我可以彈出添加UIViewController gamecenter窗口,但它已經搞亂了我的屏幕orientation。該應用程序在portrait中沒有問題,但在其他所有rotations中,它錯誤地在邊上有白色條,如其中一個視圖旋轉了90度。

我在[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];EAGLView::initWithCoder,然後我試着將它移動到applicationDidFinishLaunching的末尾,但它有相同的行爲。

任何人都可以幫忙嗎?我能做些什麼來解決或調試呢?謝謝!

+0

我想,因爲我收到沒有RootViewController的,現在我做什麼,我需要創建一個自定義視圖控制器和執行shouldAutorotate和supportedInterfaceOrientations? – Rasterman

回答

1

問題是新的UIViewController正在旋轉,當我的遊戲期望一個總是肖像畫面。要解決我創建一個自定義視圖 - 控制並實施

- (BOOL)shouldAutorotate 
{ 
    return NO; 
} 

- (NSUInteger)supportedInterfaceOrientations 
{ 
    return 0; 
}