【问题标题】:issue with animation in swift playgroundswift游乐场中的动画问题
【发布时间】: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


【解决方案1】:

这段代码运行良好

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多