问题
I created a Swift Playground on my iPad and did all of my graphics positioning on the iPad simulator. Does anyone know how to edit the size of the Xcode playground simulator? Thanks in advance.
回答1:
To change the size of a playground's liveView, set the preferredContentSize of the viewController.
import PlaygroundSupport
import UIKit
let viewController = UIViewController()
viewController.preferredContentSize = CGSize(width: 600, height: 600)
PlaygroundPage.current.liveView = viewController
回答2:
let vc = ViewController()
vc.view.frame.size = CGSize(width: 375, height: 667)
PlaygroundPage.current.liveView = vc.view
来源:https://stackoverflow.com/questions/43163383/how-to-change-the-size-of-the-xcode-playground-simulator-when-using-live-view