1

I am adding navigation controller through code, in my application. All other thing work fine, but my navigation bar overlaps with the status bar.I have tried by adding  

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone; 

but it is not working.

My other controllers in that navigation controller are in xibs only not storyboard. Please help.

David
  • 21,070
  • 7
  • 57
  • 113
Vibhooti
  • 1,183
  • 2
  • 9
  • 20

2 Answers2

1

I solved the problem with the following code (as suggested by Tacettin Özbölük):

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
    UIView *addStatusBar = [[UIView alloc] init];
    addStatusBar.frame = CGRectMake(0, 0, 320, 20);
    addStatusBar.backgroundColor = [UIColor colorWithRed:0.973 green:0.973 blue:0.973 alpha:1]; //change this to match your navigation bar
    [self.window.rootViewController.view addSubview:addStatusBar];
}
Community
  • 1
  • 1
Boggarapu
  • 313
  • 2
  • 6
  • 14
1

If you really don't want your Navigation Bar to be translucent then use this code and your problem will be solved :

self.navigationController.navigationBar.translucent = NO;
Bhavin
  • 26,755
  • 11
  • 52
  • 91