2

我已使用以下 IO6 及以下代码强制旋转:

-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    UIApplication* application = [UIApplication sharedApplication];
    if (application.statusBarOrientation != UIInterfaceOrientationPortrait)
    {
        UIViewController *c = [[UIViewController alloc]init];
        [c.view setBackgroundColor:[UIColor redColor]];
        [self.navigationController presentViewController:c animated:NO completion:^{
            [self.navigationController dismissViewControllerAnimated:NO completion:^{
            }];
        }];
    }
}

但它在 IOS7 上无法正常工作,它旋转视图控制器但再次在屏幕上设置空白视图......

你能帮我在IOS 7中解决这个问题吗...

4

1 回答 1

3

更改此行:

[self.navigationController dismissViewControllerAnimated:NO completion:^{
    }];

对此:

[self.navigationController dismissViewControllerAnimated:YES completion:^{
    }];
于 2013-09-26T18:58:03.363 回答