Double Navigation Bar in View - ios

I have a problem with a "double" navigation bar in a screen of my iPhone app.
Starting position:
Xcode 8, Swift
I have a TableView with static lines that is embedded in a navigation controller. From the first cell I then call a screen (Segue Show Detail), which is very complex (labels, text boxes, buttons, etc.). When I execute the "Reset to suggested constraints" function on the screen, the screen is supplied with "generated" constraints. This is still clear. When I run my app in the simulator (iPhone 6) or my own iPhone 6, I see on the above screen a status bar, then my right navigation bar (Back button, title) and below an "empty" 2.Navigation bar. This decreases the screen down and is no longer fully visible. If I delete the constraints for the screen with the "Clear Constraints" function, the screen in the simulator (i6) looks good as I develop in the storyboard for the iPhone 7. But when I connect my own iPhone 6 and test, the screen does not fit completely to my iPhone, because right and down is something truncated.
I suspect the error in the "generated" constraints.
Now my question:
How can I check the generated Contraints (well over 100) for errors?
In the Internet and the forum I found nothing, which could help me.
Workaround for me:
The top UI element on the screen is a label across the entire width of the screen. For this label, I set a constraint manually, in addition to the generated constraints
Label.top = Top Layout Guide.bottom + 44,
whose value I then change to the value
Label.top = Top Layout Guide.bottom
This causes the label to slide directly below the status bar in the storyboard. The navigation bar is then no longer visible in the storyboard. This makes the placement of UI-Elements at the bottom of the screen somewhat more difficult because you do not know exactly which space is still available.
The display in the simulator (i6) and on my iPhone 6 looks however through the workaround ok.
For your help I would be very grateful.
Greeting Reinhard

Related

iPhone X tool bar issue at the bottom

My app works well on all device except for iPhone X.
On iPhone X the tool bar on the bottom is shown like as shown in image
But I want to show it like shown in second image
But when ever I shift the tool bar up so that it will show properly on iPhone X then it also move upwards in other devices.
How should I solve this problem.
Actually the bottom bar of my view is inside another view thats why it is not extending accordingly.
So simply putting the bottom bar outside, on the main view and adjusting the constraint simply resolve my issue.
In my case My toolbar's bottom constraint was attached to superview's bottom. Changing it to Safe Area bottom resolved the issue for me

bar button is not showing on the navigation bar at run time

I am following this tutorial, and as shown in image-1 below, I added the "Add" bar button, but when I run the simulator it does not show up as shown in image-2.
please let me know why the "Add" button is not showing and how to fix it.
image-1:
image-2:
Two possible scenario :
Scene 1 :
Looks like you are using iPhone 6s Plus simulator and 100% zoomed. So I could see horizontal and vertical scroll both. I believe the Plus button is still there its just that u have to scroll to see it. Even the title Players is not in center :)
Use Command + 3 to zoom out the simulator and see the O/P without scroll :D
Scene 2:
If you have added Navigation bar manually make sure you add top, leading and trailing constraint to Navigation Bar. The Nav bar you added is bigger than iPhone 6 plus size and because there is no auto layout constraint added it might have extended beyond the screen.

Positioning a UISegmentedControl in a button bar

I'm trying to use a UISegmentedControl as a custom right button bar item. Using Interface Builder, when I drag the control into the navigation bar, it gets sized to be quite wide (too wide, considering the segment contents):
I've tried setting the widths of the segments to something that I think looks good and the overall control resizes, but it is pinned to the left side of the original space it was allocated. I can't seem to find a way of moving it from there. Here's a picture of what this looks like in IB in landscape:
and here's what it looks like running on an iPhone 7 Plus simulator in portrait mode:
As you can see, the segmented control is positioned way too far toward the center.
I tried a hack (suggested in this thread) of embedding the segmented control inside another view, leaving the containing view to be full width of the bar button item and constraining the segmented view to be on the right of it's container. That gets it over to the right, but here's the effect of running that on an iPhone 7 simulator (somewhat narrower than the 7 Plus):
Here the problem is that the title, which is supposed to be centered, has been pushed off to the left. I assume that this is because the (transparent) bar button item is taking up so much more width than what is needed just for the segmented control.
Is there some way of getting the right button area of the navigation bar to simply be smaller?
My steps are below:
1.Drag the segment control to navigationbar:
2.Change the segment width:
3.iPhone7 & iPhone 7Plus all looks good:

UIButton width not filling toolbar when run on simulator

I have a UIToolbar with a button in it. In the storyboard everything looks fine. The problem is when I run it on the simulator it doesn't look the same as on the storyboard.
(Note: It won't even let me add constraints to the button.)
In storyboard:
In simulator:
Bar button items do not size automatically, and the size you have set is for 4 inch and below device, because this is the default size in storyboards. However, you are running on an iPhone 6 simulator, thus the screen is wider, and the button does not fill the entire bar.
If you need to have the button fill the entire bar, you will have to do it in code, in viewDidLayout, changing the bar button item's width to that of the bar.

Legacy iOS app not stretching properly

I have a layout issue. I'm trying to make a legacy 3.5in app work on iPhone 5. As soon as I give it the Default-568h#2x.png splash image, the whole app gets aligned to the top of the screen, leaving a huge white gap at the bottom. The autosizing struts and such seem to be set properly (not using Autolayout at the moment), but the thing doesn't stretch to fill the screen. I'm not sure where to look next. I just want my poor tab bar to be at the bottom!
Since you're not using AutoLayout, now is a great time to start. Xcode 5 makes setting constraints a simple exercise.
I suspect that your tab bar frame is hard-coded to certain x, y, width, height coordinates which work well on the 3.5" screen. You can also see how your view renders on taller screens by pressing this button in the Xcode 5 Interface Builder:

Resources