2012-02-07 23 views
0

我試圖只支持風景。有一個新的要求顯示這個對話框,第一次解釋了我們的應用程序的一些事情。因此,在這種被推出,在vi​​ewDidLoad中我的第一個視圖控制器,我有這樣的代碼:介紹ModalViewController在啓動時變成我的應用程序的方向

BOOL showFirstTimeUse = [[NSUserDefaults standardUserDefaults] boolForKey:@"ShowFirstTimeUse"]; 
if (!showFirstTimeUse) { 
    FirstUseViewController *tvc = [[FirstUseViewController alloc] initWithNibName:@"FirstUseViewController" bundle:nil]; 
    tvc.modalPresentationStyle = UIModalPresentationFormSheet; 
    tvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentModalViewController:tvc animated:YES]; 
    [tvc release]; 
} 
在FirstUseViewController

然後,我有這樣的定義:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    // Return YES for supported orientations 
    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight; 
} 

在IB,我沒有改變任何的默認設置。我基本上只是將一個UIWebView放到屏幕的左上角來顯示我的數據並將它連接到一個插座,以便我可以輕鬆地顯示格式化文本。

當我現在運行我的應用程序時,此視圖控制器的演示文稿會導致我的應用程序以縱向而非橫向啓動。我該如何解決?謝謝。

回答

0

您的shouldAutorotateToInterfaceOrientation:的實現有問題;它總會評估爲真。您可能想要使用:

return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
相關問題