iPad上的UIModalPresentationFormSheet - 隐藏状态栏

时间:2016-11-07 20:59:30

标签: objective-c xcode ipad

知道为什么当模态控制器在iPad上显示为UIModalPresentationFormSheet时,无法隐藏状态栏? 覆盖preferedStatusBarHidden不起作用

1 个答案:

答案 0 :(得分:0)

您可以隐藏导航栏以抛出导航控制器。 例如使用:

[infoViewNavController setNavigationBarHidden:YES animated:NO];

infoViewNavController 是导航控制器,它将保存用于模态演示的viewController。

假设你这样称呼它:

 UINavigationController *infoViewNavController =
        [[UINavigationController alloc] initWithRootViewController:viewControllerToShow];

infoViewNavController.modalPresentationStyle = UIModalPresentationFormSheet;
infoViewNavController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[infoViewNavController setNavigationBarHidden:YES animated:NO];

self.navigationController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
self.navigationController .modalPresentationStyle = UIModalPresentationFormSheet;
[self.navigationController  presentViewController:infoViewNavController animated:YES completion:nil];