Maybe striving for a "warning free" project is futile, but I am nervous enough about Adaptive Layout/ AutoLayout that I am compelled to try and squash these warnings.
I have a uiview that I want to be dynamically sized based on the portrait screen width. I have my app set in the Build Info for Universal, Portrait only (and upside down). I have constrained the uiview the following ways:
For details please see the screenshot below.
So now I get the warnings about the view's "frame being different at run time", in particular the size and position at runtime versus what is in the canvas. Not sure why Xcode "cares" about the canvas where the class sizes are set to Any height and Any width. I thought the whole point of Adaptive layout is that sizes and positions are resolved at runtime based on the devices screen size and orientation.
If I breakdown and let Xcode "Update frames"... yes the warning goes away, but with the super large views it is virtually impossible to work graphically in the tiny canvas in a WYSIWIG fashion. Any solution here to getting rid of the warnings without creating oversized views that make working inside the canvas nearly impossible?
To get rid of the warning, and let the constraints place the views "correctly", just select the view that is giving the warning, press the little triangle thing in the bottom right corner of the storyboard:
And then select "Update frames" for "All Views in Container"
(I wish there was some way of doing this to a whole storyboard. At least I haven't found it)
Select a view and press
This will update the frame size. Repeat for all offending views. It doesn't take that long, especially if you find them by clicking on the error messages.
Thanks to this answer for the idea.
Notes
After updating to Xcode 8, and choosing some View as device, I was getting this error. The menu is different than in Xcode 7, so @Spoek's answer was no longer working. Also clicking Update or Reset was not working for me.
Update
Update Frames now has its own button. That's why I missed it before.
You can change simulated metrics size for example to 4-inch iPhone!
Or Freeform and then change the size to what suits you best.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With