2014-09-26 118 views
1

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

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

任何想法为什么发生这种情况?

回答

0

试试这个代码
1.您的视图 - 控制

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

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

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

nav.modalPresentationStyle=UIModalPresentationFormSheet;(presentingModal view) 

[self presentViewController:nav animated:YES completion:nil]; 
+0

它仍然重叠.. – taman 2014-09-26 11:38:13

+0

检查此链接,请参阅我的答案的http://计算器。 com/questions/25781169/how-to-fix-status-bar-overlap-issue-in-ios-7/25781823#25781823并且也检查这个链接。 – 2014-09-26 11:42:47

0

对于我来说,它的工作由

  1. 将导航栏和其他视图按20像素的方式显示为我的视图表现为模态视图控制器

  2. 通过设置状态栏上的黑色背景中viewDidLoad中:

    UIView *statusBarView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1024, 20)]; 
    statusBarView.backgroundColor = [UIColor blackColor]; 
    [self.view addSubview:statusBarView];