我的应用程序出现问题。 我想锁定特定视图上的旋转。为此,我使用了包含两个自定义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