0

我有一种情况,需要将仅纵向模式视图推送到导航控制器中,该控制器具有横向模式视图作为其当前视图。

虽然我重新实现了

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation   {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

但它仍在横向模式下推动视图。我也尝试过以下方式,但即使这样也行不通。

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES];
}

我尝试查看其他相关问题,但没有找到任何东西。

知道如何解决这个问题吗?

谢谢!

4

1 回答 1

0

您最好的选择是只使用 amodal view controller而不是强制视图为纵向而不考虑设备方向。

如果您想在其周围包裹一个导航控制器以保持样式一致,请查看 Apple 的Core Data Recipes 示例,了解当您添加新配方时它们如何执行此操作。

于 2010-07-13T16:29:07.017 回答