gpt4 book ai didi

ios - 如何在 Playgrounds 中显示原型(prototype)预览?

转载 作者:行者123 更新时间:2023-11-29 11:53:36 25 4
gpt4 key购买 nike

我找不到介绍如何显示 UIView 动画实时预览的更新文章。根据我在 playground 编辑器中收到的错误,Swift 中不再使用像 XCShowView() 这样的方法。

有谁知道如何在 Playgrounds 中显示原型(prototype)预览?

enter image description here

最佳答案

这适用于 Xcode 8:

import UIKit
import PlaygroundSupport

let v = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 600, height: 600)))
v.backgroundColor = UIColor.green

PlaygroundPage.current.liveView = v

使用该代码创建一个 Playground ,您应该会在实时 View 中看到一个绿色框。

记得展示“现场”助理编辑器。参见 PlaygroundSupport reference了解更多。

关于ios - 如何在 Playgrounds 中显示原型(prototype)预览?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40048501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com