0
我在發佈方向上閱讀了幾篇不同的文章,但我仍然不確定它的工作原理。我們只支持橫向導向。在didFinishLaunchingWithOptions,我做的:iPad的發佈方向對於橫向不正確(顛倒)
HomeController *myHome = [[HomeController alloc] initWithNibName:@"HomeController" bundle:nil];
myHome.navigationItem.title = @"Your Dashboard";
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myHome];
[myHome release];
self.navigationController = navController;
[navController release];
self.window.rootViewController = self.navigationController;
在我HomeController類:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
然而,當我啓動應用程序在設備上,它可以顛倒開始。我如何避免發生這種情況?我看到有人在didFinishLaunchingWithOptions中檢測到狀態欄方向。如果我這樣做了self.window.rootViewController = self.navigationController;
代碼之後:
NSLog(@"%i", [UIApplication sharedApplication].statusBarOrientation);
我總是3.從那裏,我不知道我能做些什麼來解決這個倒掛的問題。謝謝。