【问题标题】:How can I use animation for refresh control?如何使用动画进行刷新控制?
【发布时间】:2017-10-20 17:48:19
【问题描述】:

我想在表格视图中使用 Lottie 动画进行刷新控制,而不是使用活动指示器或标签。刷新控制会阻止这种类型的自定义,还是我需要其他东西? (Lottie 是一个允许 Swift 播放 Adob​​e After Effect 动画的库。)

【问题讨论】:

标签: ios uitableview swift4 uirefreshcontrol lottie


【解决方案1】:

如何在UIRefreshControl 中使用Lottie 动画:

let refreshControl = UIRefreshControl()
let loadingView = LOTAnimationView(name: "<- whatever your animation... ->")
loadingView.play()
loadingView.contentMode = .scaleAspectFit
loadingView.translatesAutoresizingMaskIntoConstraints = false
loadingView.loopAnimation = true
refreshControl.addSubview(loadingView)
loadingView <-> constraint layout to <-> refreshControl
refreshControl.tintColor = .clear

如果您在应用程序中多次使用 UIRefreshControl,您也可以继承它...

享受吧。

【讨论】:

    猜你喜欢
    • 2014-12-12
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2012-01-14
    • 2019-07-01
    • 2021-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多