在我的iPhone应用程序中,视图不会相对于设备方向旋转

时间:2011-09-19 06:34:16

标签: iphone objective-c xcode4 uiinterfaceorientation landscape-portrait

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

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

    return YES;
}

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

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

它不起作用,我怎么能这样做?该类包含一个搜索栏,表格视图如enter image description here

提前

thanx

1 个答案:

答案 0 :(得分: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..."