Mysterious navigation controller bar gone - ios

It has happened more than once, but today, something even more mysterious happened to me. After restarting my macbook and reopening Xcode, 3 of my views lost their navigation bars on the interface builder.
Like so:
[img]http://i.imgur.com/pM5prrg.png[/img]
However, running it on the simulator still shows the navigation toolbar on the top of the screen.
[img]http://i.imgur.com/joG4fjn.png[/img]
Any idea on what's happening here? I restarted my computer once again, to see if that changes anything, but to no avail.
This problem also happens sometimes, when I place a brand new view controller and embed a navigation controller into it. The toolbar simply doesn't show on the view in the interface builder.

The navigation bar in your app is generated by the navigation controller at run-time.
Interface builder has to "simulate" the run time look and content of a navigation bar, and it has to work out which controllers to apply it to.
You can also manually request a simulated navigation bar (and tab bar etc) in the settings for each view controller.

Related

Xcode Tab Bar Text Glitch

Recently, I have been trying to add a tab bar to an existing project. However, no matter what I do, the text is being cut off. I am simply trying to drag a Tab Bar Controller into the storyboard and setting it as the initial controller.
This seems to only be an issue in this project, as doing the exact same thing in a test project works fine.
Glitched tab bar
Glitched tab bar setup in storyboard
Normal tab bar in test project
Normal tab bar setup in storyboard
I am running Xcode v10.3, and the project is already on the App Store. There is no code attached to the VCs, and as far as I am aware, this should not happen.
What are some possible causes or fixes for this?
Turns out a cocoapod, AMXFontAutoScale, was to blame. I guess it scales the text of tab bars also.

How to solve Google Maps sdk orientation issues using TabViewController

I started an iOS project for iPhone where I thought might want a tab bar. I later decided that I don't want it (I want the extra screen space) and I so I tried to delete the tab bar and set my main ViewController as the initial viewController in storyboard.
This caused a weird error where the device's orientation no longer adjusts properly. For instance, switching from portrait orientation, shown in the picture:
becomes this in landscape:
If you start the app in landscape, it will look fine, but there will be a similar result when you switch to portrait. The bug manifests in the transition between screen orientations.
I've tried the following:
I restored the tab bar and the problem went away. This problem is caused by how I am removing the tab bar and not some other issue.
I searched for other articles dealing with this issue. So far, I've only seen documentation on how to install a tab bar, not how to safely remove it.
I attempted to connect the tab bar to the viewController with an IBOutlet and then set tabBar.isHidden = true. It's a bad hack, but it didn't work anyway. UITabBar has no such member.
I've tried comparing the settings between the tabBar viewController with my desired initial viewController in the Inspector, to see what may be different. Aside from the initial viewController check-box, I don't see a setting that might be causing this.
QUESTION: Is this a settings issue in storyboard (or elsewhere), or is this just a bug? My next attempt at a solution will be to delete the entire storyboard, and then recreate it and connect it back to the viewController. That's a fair amount of work I'd like to avoid if it's unnecessary.
Any help is appreciated. If I find a solution, I'll make sure to post it. Thanks!
UPDATE: I've found a workaround by going to the UI Tab Bar Controller in the Storyboard, selecting tab bar in Tab Bar Controller Scene -> Tab Bar Controller, and then checking the 'hidden' box in the inspector. This has the desired effect of getting rid of the tab bar when the app is running. It's like it's not there.
While this allows me to proceed with the app, the tab bar stuff is unnecessary code lying around in my app that I would like to get rid of.
Since I originally made this post, I've found out through experimentation that the every time I added Google's GMSMapView to a viewController, programmatically or in storyboard, I was having the above orientation issues. My original problem wasn't what I thought it was
I have since tried completely rebuilding the storyboard, viewController and all, but the problem didn't go away. I also tried overloading the orientation methods for the view to no effect.
However, if you are having this orientation problem with Google Maps sdk, imbedding the view controller that contains your GMSMapView in a tab view controller, and then hiding the tab bar (unless you want a tab bar) fixes the orientation issue in my project. It's not pretty, but it works.

Refactoring storyboard, results in navigation controller dependent scene navigation items to disappear but still working

I use Xcode 9.2 and iOS 10.x.
I would like to refactor my large main storyboard to smaller ones.
My initial login scene is embedded in a navigation controller, so all other consequating scenes are in the navigation stack and I have created view controller titles and navigation bar buttons to them.
After refactoring a branch of my scenes that are related to staff management to a new storyboard, everything has been moved correctly and links between storyboards created and the application still working as expected. I did the refactoring using Editor-->Refactor to Storyboard...
However, when you go to the editor of the new Staff storyboard you will notice that all navigation headers and buttons are missing, although working. For example, in the first scene I have a title and in the 2nd screen of the stack I have several nav bar items. All of these are missing in editor but appear when I run my application.
Does anybody knows how I can make navigation items visible again, in my new Staff storyboard, in order to edit them further e.g. add new buttons etc. ?
Is there any fix to all of this or is it a normal feature of Interface Builder/Xcode?
An oversimplified "version" of this issue could be recreated as follows:
1. you have just one view controller A embedded in a Navigation Controller.
2. you add navigation items / nav bar buttons in the navigation bar
3. you remove the navigation controller and as a result you loose in the editor any buttons

No tab bar in one child view since Xcode 9.2 update

Since I updated to Xcode 9.2, the tab bar isn't displayed anymore in one of my child views and I'm struggling to get it back.
I did everything using the storyboard.
Here is a screenshot of it:
As you can see, the same segue is used in both views but the result is not the same...
I ended up using a small workaround. Maybe it is the right way to do it and my first implementation was wrong.
So instead of embedding the tab bar controller in a nav bar controller I ended up putting each tab in a nav bar controller.
Like this:
screenshot
And now everything is working correctly.

Deformed Navigation bar

I'm not sure what happened, but while editing the title of my Navigation bar, the Navigation bar suddenly became deformed like this:
On the device, the navigation bar seems to be twice the regular height:
The navigation bar is generated by connecting a navigation controller via the storyboard. It was working fine for weeks until now. I tried the following in an attempt to remedy the problem:
Clean + Build
Restart Xcode
Restart my macbook
Turning off and on my size classes
Deleting the Navigation controller and dragging a new one back on screen.
Anyone know how to solve this problem?
Sounds more like the view controller embedded in the navigation controller is whats corrupt.
Did you try re-creating the view controller as well?

Resources