0

I have done a little research and understand that a quick fix for iOS 7+ suffering from the overlying status bar issue (introduced in iOS 7 with the new status bar layout) on a view controller is to put it in a Navigation Controller.

However, when I go to Xcode the option is greyed out. What am I doing wrong? (I am an Xcode beginner, so bear with me).

Is using a Navigation Controller the correct way to do it?

Xcode screenshot

As you can see here, the Navigation Controller is behind the status bar, not extended below it:

iOS screenshot

keldar
  • 5,548
  • 8
  • 46
  • 68
  • You can only embed navigation controller in a **UIViewController** class . In your screenshot you trying to embed tis in UIview it is not possible – Sheereen S May 11 '16 at 12:47
  • Ah - makes sense. What is the best way to fix the issue in question - which is correctly adapting the navigation bar so it isn't lapped behind the status bar? – keldar May 11 '16 at 12:49
  • 2
    see this once it helps you http://stackoverflow.com/questions/19105766/ios-7-status-bar-collides-with-navigationbar – Anbu.Karthik May 11 '16 at 12:49

2 Answers2

0

Its looking like that your controller is already in a Navigation controller stack, thats why it is not showing the option to embed in Navigation controller. Check your storyboard.

SHIV
  • 58
  • 1
  • Hi Shiv, the project is a type which doesn't use a story board (this is a "plugin" for a framework). If it is, on iOS 7+ the navbar is showing behind the status bar. – keldar May 11 '16 at 12:44
0

You Create Xib its set the Top Bar or Navigation Bar, select the XIB then see the right side select Attributes Inspector then set the status bar, Top Bar etc, then see my screenshot below,

enter image description here create UIBarbutton programmatically code is below,

viewDidLoad Method:

UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"imageName"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
[self.navigationItem setLeftBarButtonItem:leftBarButtonItem animated:NO];

its working for me, hope its helpful

Iyyappan Ravi
  • 2,944
  • 1
  • 13
  • 29