如何将旋转限制为仅一个视图控制器?
答
使用该委托方法来控制旋转,
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
// Return YES for supported orientations
return YES;
}
else
{
return NO;
}
}
你想要支持的方向返回YES和NO他人。你可以在所有的视图控制器中实现它。
答
您可以执行每个UIViewController
的shouldAutorotateToInterfaceOrientation:
方法。对于您希望给定的视图控制器支持的方向,请返回YES
将产生所需的结果。