1

我解决了所有视图中的导航栏状态栏问题,但是当我使用 presentModalViewController 显示另一个视图时,导航栏和状态栏再次重叠。我使用它来呈现新视图:

[self.parentViewController presentModalViewController:newController animated:YES];

知道为什么会这样吗?

4

2 回答 2

0

试试这个代码
1.your viewcontroller

UIViewController *View=[[UIViewController alloc]init];

2.如果你需要导航栏添加此代码

UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:View];

nav.modalPresentationStyle=UIModalPresentationFormSheet;(presentingModal view)

[self presentViewController:nav animated:YES completion:nil];
于 2014-09-26T11:30:55.987 回答
0

对我来说,它的工作原理是

  1. 对于我作为模态视图控制器呈现的视图,将导航栏和其他视图推 20 像素

  2. 通过以下方式在 viewDidload 中设置状态栏的黑色背景:

    UIView *statusBarView =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1024, 20)];
    statusBarView.backgroundColor  =  [UIColor blackColor];
    [self.view addSubview:statusBarView];
    
于 2014-09-26T12:03:09.703 回答