2
如果我設置一個觀景臺控制器作爲AppDelegate中窗口的根控制器,當應用程序在iPad上橫向啓動,該中心視圖顯示在它的縱向方向的大小,而不是調整到景觀。問題在景觀與IIViewDeckController開始爲RootController在iPad上
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
IIViewDeckContoller *rootController = [IIViewDeckController new];
self.window.rootViewController = rootController;
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
}
但是,如果我創建一個簡單的控制器作爲根控制器,然後呈現來自該根控制器視圖甲板控制器,然後一切似乎顯示就好了。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIViewController *simpleRootController = [UIViewController new];
IIViewDeckContoller *deckController = [IIViewDeckController new];
self.window.rootViewController = simpleRootController;
self.window.backgroundColor = [UIColor blackColor];
[self.window makeKeyAndVisible];
// View Deck Controller seems to have issues when it is the root controller of the main window.
// Presenting it as a modal seems to do the trick.
[simpleRootController presentViewController:self.deckController animated:NO completion:nil];
}
其他人遇到這個問題?有沒有更好的方法來解決這個問題?我沒有看到與iPhone相同的行爲。