1

OKay, this is probably pretty noob, but I couldn't find how to solve it. I dragged an iPad UIViewController to the storyboard and enabled the orientation to YES. But for some reason that view is not rotating. The status bar at the top is rotating but the view, tableview and labels inside are not rotating when you rotate the iPad. Anyone know why and how to fix it?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOr‌​ientation { return YES; } 
4

2 回答 2

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

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        //return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
        if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
           //implement your code 
        return (interfaceOrientation != UIInterfaceOrientationLandscapeRight);
    } else {

        return YES;
    }
}

我想这会对你有所帮助。

于 2012-05-24T12:44:18.687 回答
2

状态栏旋转可能意味着某些模态转场没有正确解除,只需检查即可。此外,如果它在导航控制器中,请确保堆栈中的所有视图都已设置为返回 YES。

于 2012-05-24T12:22:18.620 回答