我已經設法通過考慮[[UIScreen mainScreen] bounds].size
取向依賴於iOS 8並以編程方式對視圖進行編碼這一事實來正確顯示渲染緩衝區。所以我的代表看起來是這樣的:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *) {
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
screenHeight = screenSize.height;
screenWidth = screenSize.width;
window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
window.bounds = CGRectMake(0, 0, screenWidth, screenHeight);
MainViewController = [[UIViewController alloc] init];
glView = [[EAGLView alloc] initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
glView.bounds = CGRectMake(0, 0, screenWidth, screenHeight);
MainViewController.view = glView;
window.rootViewController = MainViewController;
[window makeKeyAndVisible];
[glView setupGame];
[glView startAnimation];
return YES;
}
來源
2014-09-23 15:31:18
Tom
我使用相同的代碼。在我的情況下,iPhone 4和iPhone 5上的所有方向都可以正常工作,但在6和6 Plus上,如果我以橫向模式啓動應用程序(報告錯誤?),它會變得混亂。也許嘗試啓動你的應用程序在肖像和負載把代碼旋轉它,如果你需要它? – Tom 2014-09-25 15:11:53
我只在iPad Mini Retina上測試過它。剛剛向蘋果發送了一個請求。現在等待正式答覆... – NightRadio 2014-09-25 18:31:44