I have added navigation bar into application window but navigation bar collides with status bar. (I need to do it with application window).
Code I’ve tried is:
UIWindow * firstWindow = [UIApplication sharedApplication].windows[0];
UINavigationBar * navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, firstWindow.frame.size.width, 64)];
/*
// I tried these also
UINavigationBar * navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, firstWindow.frame.size.width, 84)];
UINavigationBar * navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 20, firstWindow.frame.size.width, 64)];
*/
[firstWindow addSubview:navBar];
Here are results:
I looked around these and tried all answers related to default navigation bar but nothing works:
What is the height of Navigation Bar in iOS 7?
iOS 10 custom navigation bar height
iOS 7 status and navigation bar different height in storyboard than in app
UINavigationBar/Status Bar issue in IOS7
When hiding the statusbar my navigation bar moves up in iOS7
iOS 7 Status Bar Collides With NavigationBar using ViewController