drc drc - 1 year ago 83
iOS Question

What impact does simulated metrics have?

When using .xib files what impact on your code/app does changing simulated metrics have? Or is it just for your benefit as a preview tool?

Answer Source

The Simulated Metrics are mostly a design aid to help you lay out your interface. They have little direct impact on the .xib*[1]. They are very helpful because you can simulate things like your view controller being imbedded in a navigation controller, which gives you less space to work with since the navigation bar takes up some space. They are also very handy if you are laying out a viewController that will only be used in landscape. At the time they were introduced, it was the only way to check how your interface would look on the shorter iPhone 4 display and the taller iPhone 5 display*[2].

I frequently set the Size to iPhone 4 inch because: 1) I find working in the square viewController distracting, 2) It takes up much less screen real estate allowing me to see more of my Storyboard on my laptop display. This method is much less dangerous that changing the size class to wC hR because the latter will actually affect which constraints are used for different sized devices.

[1] The Size and Orientation metrics will affect the size of the viewController as it is stored in the .xib or .storyboard file. If you leave the setting as Inferred, Xcode will use 600 x 600 as the viewController's size. Normally, this makes no difference, because the viewController will be properly sized to the device when it loads.

[2] At the time Simulated Metrics were introduced, this was the way to test designs for the iPhone 4s vs. the new taller iPhone 5. Apple has since introduced other better ways of checking out designs on various sized devices.