简体   繁体   中英

Xcode Swift Playgrounds - How to make default size for ViewController

I have a playground that I am building on a Mac, but intend to use on the iPad version as-well. I have a UIViewController, which I display all my content on. On the iPad playgrounds, this ViewController automatically sizes to the area of the live view. This is what I want. On the computer although, the UIViewController (programatically created) only takes up the space of an iPhone 7. I want an iPad sized area here so I can test my content on a bigger scale. How would I go about doing this (eg: setting default size for Xcode, but keeping the behaviour on iPad).

Thanks,

Will

Just ran into this issue today. You have to set the preferredContentSize of the UIViewController.

viewController.preferredContentSize = viewController.view.frame.size

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM