UITabBarController in storyboard hides content of UITabBarItems - ios

I am a beginner using storyboards for iOS. I have been using the tab bar controller to show my content.
When I first implemented the UITabBar I could see all the icons at the bottom of the UITabController in storyboard and I could see the UITabBarItem at the bottom of each UIViewController. Why is there now a blank grey bar? I can't seem to change the content either in storyboard. I tried adding another UITabBarController but got the same problem, it also has a dark grey bar at the bottom. However when I run the app all the icons appear. How do I fix this so I can see the UITabBarItems in storyboard or should I just try updating them programmatically instead?

Showing a tab bar or not is one of the couple of simulated metrics used in Interface Builder. As such they only serve to have an idea of how your controller would look under different conditions but do not really change anything to the actual controller.
Most of the time the default Inferred option will try to deduce from the Storyboard configuration how it should look like. In your case just connect the tab bar controller to your controller through the viewControllers outlet.
In contrast, below you have some View Controller properties that change both how your controller is previewed in Interface Builder and also its actual behavior (for instance try changing Adjusts Scroll View Insets or Extended Edges).

Related

Navigation bar item automatically changes its height and position in storyboard

I have a project which was build in Xcode 8.2 and now when I run it using Xcode 9.2. I am facing problems with the custom navigation title and bar buttons in the view controllers. In my storyboard I have a View Controller and on its Navigation bar I have a custom navigation view with a label used as the navigation title.
Since we cannot add constraints on the navigation view, I have given autolayout for both the view and label. Now when I run the project, the custom navigation title has disappeared. So I opened the storyboard to check what really happened, I was shocked to see that navigation view's origin.y value is changed to some other value, like -44, -88, etc. Now I edited the origin.y value, saved and run the project, but still the view was not seen. So now when I checked back in the storyboard the frame of the view was changed to some other value. I tried creating new custom navigation view, but no luck. This keeps happening and I am really worried. I really appreciate if you guys can give me some information on this issue.
Click to show screenshot of custom view in the navigation bar

iPhone X - Hidden status bar pushes Navigation Bar upwards

I'm testing iPhone X behavior using the Xcode simulator. For some odd reason, if I'm hiding the Status Bar the Navigation Bar pushed upwards causing the title to completely disappear and cutting the left and right buttons. This is happening only on the iPhone X.
Illustration:
How can I hide the status bar and keep the Navigation Bar at a visible position?
UPDATE:
Sample project for your convince:
https://drive.google.com/file/d/0B5qJARV-Oc9ra1hvZkpXZm9lRUE/view?usp=sharing
One solution is to embed the navigation controller inside a container view controller which is properly constrained to the safe area.
Just create another view controller and drag a "Container View" from the Object Library. This view has top, bottom, leading, and trailing constraints to the safe area, all with constants equal to 0. If you control-drag from the container view to the navigation controller, you'll get an option to set an "embed segue" which will embed the selected view controller as a child view controller.
I set the status bar to be hidden on the new view controller I created, and it works fine.
This feels like something that UINavigationBar should handle automatically, but this workaround seems like it should work pretty well.
Another note: if you change the color of the navigation bar, you'll also need to create another view above the container view, and change its color to match the color of the navigation bar.
I, for a small app, changed from using a Push to a Modal segue and adding in my own navigation bar. I used Push because it looks good, and already had a Modal for another part, which I wanted to animate differently for style reasons.
For smaller apps this may be the quickest and easiest solution, but my next update I need to use the navigation controller. For that I think I'll switch on the status bar, which is no big deal for me and allows it to work.
I think you need to use "safeAreaLayoutGuide" new update in iOS 11
Apple has provided us with the necessary APIs to get around the unsafe regions of this iphone x. We do this by using the new safeAreaLayoutGuide anchors in our code
safeAreaLayoutGuide

UITableView within a UINavigationController within a UITabBarController, unwanted bottom toolbar

I'm having trouble with this hierarchy producing an unwanted empty UIToolbar directly above my TabBar.
I've tried using the inspector in XCode to figure out where it's coming from but the view heirarchy is not clear about what this toolbar is nested within. This seems like it would be a common problem but I'm not having any luck searching for solutions.
Check your storyboard in the interface builder, under the Attributes Inspector > Simulated Metrics > Bottom Bar. Without knowing more about your project, it should be set to "inferred" (as in, inferred from the Tab Bar navigation controller).

Storyboard / Navigation Bar issue in Xcode

I'm experiencing a bit of a weird issue and I'm hoping someone can point me in the right direction.
In Xcode, using storyboard, I have a view controller that inherits a navigation bar. This is working fine. Where the issue is is that when I add an element to the view controller (ie, UIButton, UILabel, etc) and run the application on my phone, the Y positioning of the element is off by the amount of the height of the navigation bar.
Let's say I wanted to have a UIButton DIRECTLY BELOW the navigation bar, I would have to move it UNDER the navigation bar, to the very top of the view controller on the Storyboard. On my phone it would be directly below (Y positioning) the Navigation Bar.
I'm fairly new to iOS development, so I'm not even sure where to begin. I tried enabling / disabling Auto Layout, which didn't change anything.
Try this:
Click on your view controller, in the Attributes Inspector uncheck the "Adjust scroll view insets" option.

UINavigationController toolbar 100% transparent

In a storyboard I create a ![UINavigationController] with its root view controller a UIViewcontroller. In the toolbar I have a segmented control. I made it transparent, but only has the normal tint, I expect to see the normal background or the table view blurred under it, but its 100% transparent for some reason.
This is a known bug in iOS7, when presenting a popover from a bar button item.
First open a bug report so Apple gives this issue more priority.
As a workaround, make sure to set the edges for extended layout to none for view controllers inside popovers. For reference, you can see in Apple's calendar app they also do this. There is no translucency under popover navigation bars and toolbars.

Resources