【发布时间】:2020-04-29 08:07:30
【问题描述】:
我对 swift 动画完全不熟悉,我通过使用 Playground 开始了这个概念,下面是我的代码,我不知道为什么它不起作用。
import UIKit
import PlaygroundSupport
let liveViewFrame = CGRect(x: 0, y: 0, width: 500, height: 500)
let liveView = UIView(frame: liveViewFrame)
liveView.backgroundColor = .white
PlaygroundPage.current.liveView = liveView
let smallFrame = CGRect(x: 0, y: 0, width: 100, height: 100)
let square = UIView(frame: smallFrame)
square.backgroundColor = .purple
liveView.addSubview(square)
UIView.animate(withDuration: 3.0) {
liveView.backgroundColor = .blue
}
【问题讨论】:
-
它对我来说工作正常,先生......
标签: swift animation uikit swift-playground