UINavigationBar is not showing despite being embedded in NavigationController - ios

I have my ViewControllers embedded in a Navigation Controller, however when I run the app the navigation bar doesn't appear, instead appears as follows:
This is however how my VC in the storyboard looks:
Does anybody have an idea on why might this be happening?
Kind regards - thanks in advance!

Please check if your navigation bar is not hidden, you can do it by isNavigationBarHidden on UINavigationController instance. You can set this value either in storyboard or in code by calling setNavigationBarHidden(_ hidden: Bool, animated: Bool).

Try and Drag Navigation Item to the navigation bar from the storyboard. It worked for me. If not, try setting constraints for the navigation bar. I know it sounds random, but that's how I solved this issue most of the times.

Related

How to reload view of selectedViewController in UITabBarViewController when hiding/showing TabBar manually?

I have an issue and I'm not sure how to approach this. I have a dynamic custom UITabBarController and I'm setting its viewControllers like this
setViewControllers(viewControllers, animated: false)
Is working fine but I also want to hide the tabBar under certain scenarios. For this I'm just doing this:
tabBar.isHidden = true
So far so easy. But I realised that the current selectedViewController has some buttons attached to the bottom using some constraints and they're not being updated when the tab bar is hidden or displayed again. If I change to another tab and then go back, the view is refreshed and everything is fine, so I tried using selectedViewController?.view.layoutIfNeeded() once the tab bar visibility changes, but didn't work.
Anyone can give an idea of what's happening? Thanks.

Black smudge under navigation controller when transitioning

When I'm tabbing between pages attached to a navigation controller, sometimes there is a black mark under the navigation bar..
any ideas how to remove this?
they're just blank pages.
let vc = self.storyboard!.instantiateViewController(withIdentifier: page)
self.show(vc, sender: self)
i have tried setting background to white in navigation controller class like some threads recommend which didn't do anything.
The "smudge" happens when you transition between a view controller whose edgesForExtendedLayout include .top and one that does not. To avoid it, make sure all your view controllers have the same edgesForExtendedLayout and the same extendedLayoutIncludesOpaqueBars settings.
for me, It happens when I use ToolBar from libraries. fix by using ToolBar from the navigation controller itself by toggle "Shows Toolbar" in Navigation Controller's Attribute Inspector
I had this issue with my app as well, except I had a black smudge under the Navigation Bar and a Toolbar. I eventually discovered that the problem was because of the isTranslucent property of the UIToolbar I had in multiple scenes.
Once I set this property to false, the black smudge under both the Navigation Bar and the Toolbar went away (why disabling translucency on the Toolbar fixes the Navigation Bar as well, I don't know). I had tried disabling isTranslucent on the UINavigationBar, but that only fixed the smudge on top. Luckily, in my case, nothing will ever be under the Toolbar, so disabling translucency is not a problem. If translucency under the Toolbar is required, this solution may not work for you.

Xcode simulator - Navigation bar is missing

I don't know why but my navigation bar is missing from my ios simulation.
Anybody know where might be the problem?
Yes I have "Shows Navigation bar" and I don't have any warnings.
I wanted to try "Update frames" but I don't have this option available.
I am using Xcode 7.3 and Swift.
Thank you
You can solve by embedding a navigation controller:
As other people have said in the comments without showing some code or screenshot of IB it's hard to find out where the problem is... But here's some things to checkout.
Are you sure your view controller is embedded in a UINavigationController?
If you are using Storyboards you should have something like this:
In code instead you might have set the window.rootViewController property in the AppDelegate to the content view controller rather than the navigation controller which is supposed to contain it.
Its depend how to embedding navigation controller but you can try to embedding navigation controller following below way and than run application and check in simulator : Go to Editor in xcode -> Embed in -> Navigation Controller.
I had the same problem: the navigation bar was showing on the root view in Storyboard, but when running the Simulator - there was no navigation bar at the top of the views. This solved it:
Navigation Controller > Navigation Bar > UNCHECK Translucent (it is checked by default). This did two things:
My Navigation Bar shows on all subsequent views.
The topmost subview on subsequent views is now at Y=0, and not Y=64.
There are two possibilities.
1) May be you didn't Embeded navigationcontroller before your viewcontroller. so, add Navigation controller with go to
Editor -> Embededin -> Navigation controller.
2) If you have add navigation controller but May be you have set NONE as topbar of Viewcontroller.

TabBarController in NavigationController does not show TabBar in viewControllers

I have a UITabBarController to whose controllers I would like to attach navigation. So I inserted the NavigationController as the entry controller, and the tabBarController as its root. All seems working fine, but for the tabBar. Basically it does not show, albeit the StoryBoard I attach seems to say differently. I also attach the Account Screen not showing any navigation bar nor, of course, any back button.
Thanks,
Fabrizio
Just a quick answer. I think you should put UINavigationController inside the TabBarController instead of the other way round. It will solve most of your problems.
Steps: Editor -> Embed in -> Navigation Controller
See the below screen shot on how to add a Navigation Controller to a View Controller.
You are following wrong approach, IOS does not allow you to use tabbarview controller as root of navigation controller, it always display black screen. I have faced same problem and as a solution i have added navigation bar after tabbar controller. Yes it becomes difficult to manage, but you can use that way and it will work.
If you use programmatic approach instead of storyboard then it is possible, see this link
Even you can try from Editor option of XCODE, select tabbar controller you have added from storyboad then go to Editor->Embedded in, you will see that navigation bar controller is disable.
This is also give you idea that it will not work.

Navigationbar not visible during runtime

Agh, it seems iOS7 has changed the way we use the navigation bars are status bar.
I have a UINavigationController with one view (UITableView) as my root view controller. In the IB I can see the nag bar and the title. When I run the app - the navigation bar is not there and my cells overlap in the status bar.
Can someone tell me whats going on?
Many thanks!
So I found the solution to the problem. Incase anyone else has this issue. I was loading the UITableView controller directly in code. I used a StoryboardID on the UITableViewController and not the UINavigationController. As soon as I changed it - everything worked as per normal.
Silly little things...

Resources