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.
Related
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
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.
I got a big project where I want to make a popover in 1 of my views, when click on a button.
The problem is that when I click the button it just shows a view with nothing in.
I have tried make a new project and do the same where it works fine, no problems there..
How I done it.
Made a new view, freeform it so it is the size I want.
Den from the button in other view I control+drag over to the new view and choose Present as Popover. But it just wont show the things I have in the new view, where it here is just a label, and have constraint on it show it should be in the middle of the view, and have tried moving it around, to see if any effects with that, but nothing happens..
I also have something else happen when click on the button, but tried removing that, and that did not help either.. Have also tried making button other places in my app, but it is the same problem.
I have not wrote code for it, just done it in the storyboard.
Screenshot from storyboard: http://i.imgur.com/Rj0uaUz.png
Screenshot from app showing the view: http://i.imgur.com/DalGOU1.png
I did found out what the problem was.
I had changed from wAny hAny too wRegular hAny because only making for iPad.
I found out that was mistake to do it this way. Because then the popover show in the app would be wAny hAny instead of the wRegular hAny I was working on in the storyboard..
So changed to wAny hAny and then I instead changed to iPad view under Simulated Metrics instead of to see how it look on iPad.
I am having issues with a specific view on my storyboard. The button and textview don't show in the right place when using the ipad. It works perfect for the iPhone, however. I am using one storyboard for the both of them. (Not one each) Here is a screenshot for what it is showing and the blue rect is for where the textview should be and the red is for where the GPS button, which is visible to the left, should show. Any ideas? I have tried setting and reseting the constraints, but it has had zero effect.
Thanks
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.