Toolbar not filling the whole width at iPad - ios

I am reading (through O'Reilly Safari) the book Learning iPad Programming and there is a modal view with a toolbar and 2 buttons ("Cancel" and "Done") at the top.
My problem is that when I try to recreate that universal app, at the iPad simulator the toolbar doesn't use the whole window width:
There is a "flexible space" element between the buttons, but it seems not to affect the parent toolbar.
Can anybody please advise me how to stretch the toolbar and the textfield, maybe I need to set some property of it in Xcode 5?
UPDATE 2:
I've attached 2 new screenshots - don't see any "autoresizing" in Xcode 5:
I've submitted my question at Github too.

It Looks like your View doesn't resize to the complete width. I guess it does not have the Autoresizing Width attribute. You can set in in InterfaceBuilder of your xib in the size inspector.

Related

Double Navigation Bar in View

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

Storyboard preview issue after converting to Swift 3/Xcode 8

Something strange happened to my project after I upgraded to Xcode 8 and converted the project to Swift 3.
Most interesting thing is that layout shows fine in the simulator but in the Preview everything is shifted to the right. Center of all devices appears to be almost at the right edge. For example I drag a label to the storyboard select Align Horizontally and add a constraint to the top... in preview it shows up for all devices shifted to the right instead of in the middle but in the simulator label is in the middle, exactly where it is supposed to be.
Also, if I create a new ViewController is would work just fine in preview and simulator... Anybody knows what can cause this issue?
In Interface Builder, select the view controller and then choose "Update Frames" from the "Resolve Auto-Layout Issues" popover menu that is in the lower right corner of the Interface Builder canvas. The issue is that in Xcode 8, the size of the previewed scenes has changed. If you tell it to "Update Frames", the various subviews should be adjusted to reflect the new "simulated size" for the scene's top level view (assuming all of your constraints are properly defined).
Leaving Xcode and re-starting worked for me to get the correct view per device in Storyboard again.

Content inset not working Storyboard Xcode8

Recently I have updated Xcode 7.3 to 8. While opening the project the project settings also have been updated for new Xcode.
Now the insets given for a button image for positioning the image inside button frame is not working as in previous Xcode(7.3) version.
The image insets are given through storyboard. Image was used here to have large clickable area for button than the button image display area. Is there any other options to get it through storyboard.
In Xcode 8 the button content/title/image insets have moved to the Size Inspector tab:
Which seems quite logical by the way! 😀
I had this same problem and solved it with image insets and the Horizontal/Vertical Alignment controls. My problem was that I had the wrong alignment controls selected. Once I changed it my insets worked properly for what I was trying to accomplish.
I created a button with an image and the I wanted to shrink the image down to not fill up the entire button So I set the image to the UIButton image property in storyboard and then set the image insets to my liking
But it did not center my image with the inset of 5 on each side. The image would look like this and that was not what I wanted
If you change the horizontal/vertical alignment controls I was able to the button image to my desired look I wanted
tl;dr: Set the "Style" to "Default"
(if you're on Xcode 13, iOS 15 or later)
Long answer:
I know the very title of this question references Xcode 8 - but this comes up in a Google search and I had issues in Xcode 13 (iOS 15) where the content/title/image insets are not reflected in the storyboard or at runtime. This was due to the new button system, and the solution was to set the button's "Style" to "Default" (it was "Plain").
Its weird,but it actually works until you add collectionview or tableview in your Viewcontroller. Try setting the inset without having the scrollview or tableview in your view controller
There is a weird behavior when having a UITableView or UIScrollView on the scene (as mentioned by #RAHUL JOSHI). Sample
Solution: Just ignore the previsualization bug as on runtime this will work normally.
Content inset for button is working perfect in xcode 8 beta.
See below screenshot that i have taken from xcode8 beta.

different storyboard in Xcode/iOS simulator

Suddenly my storyboard changed and it only displays one of the four textfields. When I run the code in the iOS simulator, I see all the four text fields.
I'm quite new to Xcode and would like to know how I can change my storyboard back so I see the same as in the simulator. It was right before.
A screenshot:
You probably haven't updated the frames of the text fields to match your auto layout constraints. Click on tie-fighter icon (|-Δ-|) in the button bar under the canvas. Here you can choose "Update frames" for all views.

Xcode swift UIView bottom bar does not display

I'm a beginner in iOs development but I'm a web wedeveloper.
I was trying some small things on Xcode and I face a problem without finding solution or usefull information on the web, take a look to my UiView below
which is quite large, and has a bottom bar with Done button, and and another bar with some button.
But when I'm running the simulator, I can't see this bottom bar guide, I do have a button on it, I have an action on it, the "Hidden" field is not selected.
Any idea why it's happenning (Using Xcode 6 beta 7)?
Set left and right border constraints to 0, and "center horizontally" constraint as well.

Resources