可能重複:
ViewController not responding to didRotateFromInterfaceOrientationdidRotateFromInterfaceOrientation旋轉時不會觸發?
我在與didRotateFromInterfaceOrientation方法在我的ViewController子類的一個不點火的麻煩。
我有一個iPad應用程序w/UISplitViewController作爲主視圖。在細節方面,我使用「隱藏」(無工具欄,導航欄)導航控制器進行懶惰視圖切換。我想要捕捉didRotateFromInterfaceOrientation的ViewController在navcontroller層次結構中有兩層。 (這一切都不應該有所作爲,但我包括此情況下的信息還有,我不知道某些特定的情況下約)
我:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
// This doesn't work. :(
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
NSLog(@"Rotate Go!");
}
視圖旋轉就好了,但是RotateFromInterfaceOrientation從不會觸發。
任何想法我失蹤?
你有沒有uitabbar?因爲如果你是這樣的話,你應該創建一個uitabbar類,並且在這個類上實現「shouldAutorotateToInterfaceOrientation」,這樣所有其他的控制器都會收到這個循環消息。 – 2011-04-25 01:40:17
沒有。我使用的UISplitViewController,UIToolbar和UINavigationController(工具欄隱藏,所以不同的視圖共享其他工具欄)。但沒有UITabBar ... – DOOManiac 2011-04-25 03:26:27
根據蘋果,你的UISplitViewController必須是你的應用程序窗口中的根視圖。如果情況不是這樣,你可以體驗到一些奇怪的東西。檢查這個線程http://stackoverflow.com/questions/2734016/uisplitviewcontroller-doesnt-autorotate – 2011-04-25 11:52:09