Storyboard preview issue after converting to Swift 3/Xcode 8 - ios

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.

Related

Autolayout on preview and simulator looks different

Autolayout for landscape mode isn't working.
Here's what I see in storyboard (preview):
https://i.snag.gy/KZENBG.jpg
And here's simulator:
https://i.snag.gy/4EPsH8.jpg
As you can see, toolbar is disappearing to somewhere off the screen. I've tried both Top Space to Superview = Standart value and Top Space to Top Layout Guide = Standart value in toolbar's contraints, but got no result.
P.S. In the portrait mode everything works good.
First of all change device in preview and set it to iPhone 5 and then check looking perfect or not.If not then try to set from Size inspector from Utility area.
If this doesn't work then try this.
Delete Derived data of your project.Then run again.
Derived Data located at
~/Library/Developer/Xcode/DerivedData/(your app data)

Xcode storyboard - can't drag to make constraint, items disappear when switch between size classes

In my project I want the iPhone portrait version to stretch a view but the landscape and iPad version to have a specific width so it doesn't stretch since the iPad is wide and so is iPhone in landscape. The problem is, when I set one up, I switch to the other one and everything has disappeared. If I start dragging views from the left panel to the storyboard they appear again, but when I switch to the previous size class everything has disappeared on that one. I also can almost never drag on that ViewController's box to do what I want. For example, if I want to drag from a UIButton to the background of the layout it would normally bring up a menu with 'vertical spacing' etc but now it comes up with 'Outlets Delegate'.
How do I fix these issues? Nothing is working.
Solved it by deleting everything in the ViewController, re-adding everything in w-Any h-Any and adding specific constraints in the relevant size classes.

All Subviews got disabled in ViewController Scene

I'm experiencing a weird problem in my storyboard. I can't found any of my subviews in my view controller (subviews of uiview) and at the same time all the them got disabled there in view controller scene. But if I run the project in simulator everything is working fine...
If you are using xcode 6.0, please update you xcode to the latest version as there was a bug in xcode 6.0 that whenever you resize a control in a viewController, all the controls of that viewController changes its height and width to 0. Meanwhile you can change you controls dimensions from the Size inspector in the right hand side rather that doing it by clicking and dragging the control to avoid this problem. I hope this helps you.

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.

Toolbar not filling the whole width at iPad

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.

Resources