2012-08-27 87 views
0

我有一個簡單的ios導航應用程序。我的問題是在viewController之間瀏覽,只允許在縱向顯示viewController,必須顯示在橫向viewController。xcode從縱向視圖導航到橫向視圖

問題是,第二個viewController不會顯示在加載景觀。如果我旋轉設備,它會更新,因爲它應該,但我希望,因爲它只支持橫向比它應該自動地捕捉到景觀過渡到視圖的第一位。有任何想法嗎?

感謝

回答

0

你應該實施shouldAutorotateToFaceInterfaceOrientation:

在PortraitviewController.m將這個:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return interfaceOrientation == UIInterfaceOrientationPortrait; 
} 

這在LandscapeviewController.m:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 
+0

我已經有這在那裏。這似乎沒有任何影響的問題。 – Matt

+0

該函數應該在視圖加載時調用,是否被調用?檢查NSLog的或斷點 – WolfLink

相關問題