2011-11-17 68 views
1

我用UITabBarController創建了xib,因爲我有3個navigationControllers用於3個視圖控制器。UITabBarController的定位問題iOS

我的問題是當我旋轉shouldAutorotateToInterfaceOrientation不調用。

任何人都可以幫助我如何在UITabBarContoller視圖中使用shouldAutorotateToInterfaceOrientation

在此先感謝...

+0

我也面臨這個問題。我在同一頁面上有兩個標籤欄控制器。使用單個Tab Bar Controller工作得很好。只有一個圖形鏈接到rootviewcontroller。沒有代碼要粘貼,因爲這是以圖形方式設置的。 – TamusJRoyce

回答

3

在的UITabBarController的情況下,如果你想旋轉你必須在所有的視圖控制器的方法-shouldAutorotateToInterfaceOrientation返回YES,視圖否則將無法轉動。

+0

是的,我寫了下面的代碼在所有三個viewcontrollers但是當我旋轉shouldAutoRotate方法是沒有得到所謂的:「 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { \t //返回YES爲支撐取向 \t如果(UI_USER_INTERFACE_IDIOM(。 )== UIUserInterfaceIdiomPad) \t { \t \t返回YES; \t} \t其他 \t \t回報(interfaceOrientation == UIInterfaceOrientationPortrait);} 」 –

+0

試試這個。 (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {0121};}}}}}}}}返回YES; } – mAc

+0

對於iPad,如果您沒有返回YES,請返回YES。告訴我您正在爲iPhone或iPad或兩者製作應用程序。 – mAc