我的應用程序出現問題。 我想鎖定特定視圖上的旋轉。爲此,我使用了包含兩個自定義viewController的rootviewcontroller。 我嘗試重寫我的兩個viewcontrollers shouldAutorotateToInterfaceOrientation方法,但如果我允許所有的旋轉我的rootViewController,我所有的viewcontrollers可以像我的rootviewcontroller旋轉,我不明白爲什麼。RootviewController和viewControllers旋轉
其實我使用這種配置:
RootviewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//By default, i allow all rotation
return YES
}
FirstCustomviewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//On my first viewController, I allow only orientation in portrait
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
但在所有情況下,允許所有旋轉(我認爲它來自RootViewController的),爲什麼我不能重寫此方法? 我能做些什麼?
感謝
這樣做不是一個好習慣。 :(你應該支持所有單獨的'UIViewController'的可用方向,你推入你的應用程序......只是爲了你的用戶。:) – holex 2012-08-01 13:52:05