2

在我的 iPhone 应用程序中,我有以下代码来相对于设备方向旋转视图。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations

    return YES;
}

当设备旋转到横向模式时,视图不会旋转。

我试过了 return (interfaceOrientation == UIDeviceOrientationLandscapeLeft);

它不起作用,我该怎么做?该类包含一个搜索栏,像这样的表格视图在此处输入图像描述

提前谢谢

4

1 回答 1

3
I think the reason should be the below issue:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations

    return YES;
}


"You should write return YES; in every viewController in your Application. Even in one class if you write return No;  it will not work obviously..."
于 2011-09-19T06:43:27.337 回答