2012-06-14 23 views
13

我正在構建一個ipad應用程序。當應用程序啓動時,我將它顯示在橫向右鍵模式下。但是,一旦應用程序啓動後,我得到這個消息兩階段旋轉動畫已棄用。這個應用程序應該使用更流暢的單級動畫

Two-stage rotation animation is deprecated. This application should use the smoother single-stage animation 

我用我所有的類此方法

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

我也把我的支持的接口方向(新iPad)景觀就在我的plist文件。 如何解決此警告消息?

+0

如果您嘗試使用模態UITabBarController(更新,是的,您可以),然後看解決方案[這裏](http://stackoverflow.com/questions/6271978/presenting-uitabbarcontroller-modally-autorotate-problem)。官方解釋爲什麼這件事[這裏](http://stackoverflow.com/questions/6636683/how-to-eliminate-two-stage-rotation-warning)。 – Alexander

+0

@亞歷山大我沒有模態地顯示標籤欄。 – southpark

+0

你是「登錄屏幕」的NavigationController嗎?所有的控制器,必須是「rootViewController」,不應該被用作「模式」。 – Alexander

回答

15

我剛剛意識到 - 在閱讀this答案後 - 我簡單地使用Tab Bar Controller錯誤:標籤欄應該只用作根控制器,但是我在它之前插入了一個導航控制器。

+0

看來標籤欄控制器可以在iOS8的導航控制器中使用,但在iOS7中會出現錯誤。 – supNate

1

的問題是,您的應用使用這些方法,這是在安裝iOS 5.0棄用之一:

didAnimateFirstHalfOfRotationToInterfaceOrientation: 
willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: 
willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: 

您需要修改您的視圖控制器來覆蓋willAnimateRotationToInterfaceOrientation:duration:代替,並覆蓋所有的「HalfOfRotation」方法。

+0

我在哪裏放置此方法。 – southpark

+0

我的應用程序的確切功能是 - 我有一個tabbar應用程序。我在我的appdelegate中啓動一個tabbarcontroller,並將所有的類添加到tabbarcontroller的數組中。然後,我在標籤欄的前面添加一個登錄屏幕,登錄後我顯示標籤欄。我的應用程序以橫向模式打開,但我收到此警告。也因爲這個我想我的鍵盤尺寸不正確。在橫向模式下顯示鍵盤寬度和高度時,它給了我寬度= 352和高度= 1024在iPad 3中。我似乎系統不知道它目前在橫向模式。謝謝 – southpark

+0

您是否搜索過所有已棄用方法的源代碼? –

0

ckeck您的數組聲明標籤欄 ..possible錯誤沒有做: 我聲明數組oblects分配

tabBarController.viewControllers = tabControlArry; 
[tabControlArry addObject:navCOntroller]; 
[tabControlArry addObject:navController1]; 

正確的方法後:

[tabControlArry addObject:navCOntroller]; 
[tabControlArry addObject:navController1]; 
tabBarController.viewControllers = tabControlArry; 
7

您還可以收到此錯誤信息如果您已經在故事板中以root身份運行帶有空白標籤欄控制器的應用程序。我剛剛開始使用應用程序,而我的UITabBarController目前還沒有視圖控制器,但正在呈現登錄模式。

+0

我正是這樣。謝謝。 – Skrew

0

此錯誤消息與TabBarController用法有關。如果您沒有將您的tabBarController作爲您的應用的「根控制器」,那麼您可以預料到此錯誤。所以讓你的TabBarController作爲根控制器&這個錯誤不會再糾纏你。

相關問題