PresentModalViewController overlaps the navigation bar and status bar iOS 7

1.5k views Asked by At

I resolved the navigation bar status bar issue in all my views, but when I use presentModalViewController to show another view, navigation bar and status bar overlaps again.I am using this for presenting new view:

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

Any idea to why this is happening?

2

There are 2 answers

1
Ganesh Kumar On

Try this code
1.your viewcontroller

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

2.If u need Navigation bar add this code

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

nav.modalPresentationStyle=UIModalPresentationFormSheet;(presentingModal view)

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

For me, it worked by

  1. pushing the navigation bar and other views by 20 pixels for the view that i was presenting as modal view controller

  2. setting the black color background for status bar in viewDidload by:

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