1

我正在使用以下代码实例化游乐场实时视图:

import UIKit
import PlaygroundSupport

let view = UIView()
view.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
view.backgroundColor = .white


PlaygroundPage.current.liveView = view

出现的实时取景卡在屏幕顶部,我无法通过更改帧的 x 和 y 值来更改它的位置。如何让视图在屏幕上移动/居中?

它是如何出来的照片:

Xcode 实时视图

4

0 回答 0