如何在使用实时视图时更改Xcode Playground Simulator的大小?

时间:2023-01-23 18:06:45

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.

我在iPad上创建了一个Swift Playground,并在iPad模拟器上完成了我的所有图形定位。有谁知道如何编辑Xcode游乐场模拟器的大小?提前致谢。

1 个解决方案

#1


1  

To change the size of a playground's liveView, set the preferredContentSize of the viewController.

要更改playground的liveView的大小,请设置viewController的preferredContentSize。

import PlaygroundSupport
import UIKit

let viewController = UIViewController()
viewController.preferredContentSize = CGSize(width: 600, height: 600)
PlaygroundPage.current.liveView = viewController

#1


1  

To change the size of a playground's liveView, set the preferredContentSize of the viewController.

要更改playground的liveView的大小,请设置viewController的preferredContentSize。

import PlaygroundSupport
import UIKit

let viewController = UIViewController()
viewController.preferredContentSize = CGSize(width: 600, height: 600)
PlaygroundPage.current.liveView = viewController