iosxcodeautolayoutadaptive-layout

Frame "will be different at run time".... Isn't that the whole point?


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:

  1. Aligned the view's Center to Superview's center X
  2. Made the view's width proportional to the Superview's width
  3. Gave the view an aspect ratio constraint of 1:1
  4. Given the view a vertical constraint to the superview's top

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?

Canvas screenshot


Solution

  • You can change simulated metrics size for example to 4-inch iPhone!

    enter image description here

    Or Freeform and then change the size to what suits you best.

    enter image description here