基于每个视图的屏幕旋转

时间:2013-11-10 03:55:32

标签: iphone xcode ios7

使用iOS7,即使应用程序在“常规”下将“设备方向”设置为横向和纵向。我的应用程序中有一些屏幕,我不希望能够旋转。

如何选择在设备转动时旋转哪些视图?

我尝试使用shouldAutorotateToInterfaceOrientation但我无法让它工作。

有人用新软件完成了这项工作吗?

2 个答案:

答案 0 :(得分:1)

在您希望它只是横向的视图中尝试以下代码,并在您希望它只是肖像的视图中将横向部分更改为纵向。

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

-(NSUInteger)supportedInterfaceOrientations
{

return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}

答案 1 :(得分:0)

尝试覆盖- (BOOL)shouldAutorotate并返回NO

相关问题