Im working on an app with a viewcontroller buried deep inside a drill down. Im working with autolayout and would like to view my changes without having to go thru the rest of the app processes.

is there a way to view what a scene will look like onscreen without having to run the entire app?

有帮助吗?

解决方案

There is a menu option called simulate document. Unfortunately, newer versions of Xcode no longer have this available for iOS apps, OSX only.

其他提示

If you only want to see the effect of changing between 3.5inch and 4inch phones, or orientation changes, you can change the simulated metrics on the storyboard. This will show you how your ui elements will lay themselves out based on your autolayout settings. Anything you are doing in your code in your view controller won't take effect since you're not actually running anything. This will only show you results based on things you have set in the storyboard.

To do this, select your view controller on the storyboard and open the Attributes Inspector (Cmd+Option+4).

All of the simulated metrics are likely set to Inferred. You can change the size and orientation here.

Using this you can at least find some errors. Say I have a button at the bottom of the view, but I set the constraint to "Top Space To Superview" instead of bottom. When I change the Size Simulated Metric to the 3.5 inch, this button will be off the bottom of the screen.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top