即使我在shouldAutorotate上返回NO,也会出现旋转视图的问题

时间:2012-06-06 22:53:47

标签: objective-c ios uiview uiviewcontroller

我有一个ViewController,我在那里有这个代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return NO;

}

但是,如果我更改方向,视图会旋转。有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

以下是我如何将iPad保持在横向模式:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
    return YES;
}

else
{
    return NO;
}

}