You add sub-views to the stackview, then declare which axis you want it to be aligned on, how you want the items to be spaced out and so on. One nice way of laying out elements without too much hassle is with UIStackView, introduced in iOS 9. ![]() If you’re mocking up a UIKit layout in iPad playgrounds then, you’re going to have to write the layout programmatically. But what about more complex layouts? Playgrounds doesn’t come with Xcode’s developer tools such as interface builder or the various scene editors. Here, I’ve subclassed UIViewController and wrapped in a UINavigationController, as this gives us the title bar, and an easy way to add a couple of buttons either side of the bar.įor very simple apps, this might be all the layout they need. ![]() ![]() liveView = UINavigationController ( rootViewController : controller ) Import UIKit import PlaygroundSupport class ViewController : UIViewController let controller = ViewController () PlaygroundPage.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |