OGeek|极客世界-中国程序员成长平台

标题: ios - 如何使用动画进行刷新控制? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:02
标题: ios - 如何使用动画进行刷新控制?

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



Best Answer-推荐答案


如何在 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,您也可以继承它...

享受吧。

关于ios - 如何使用动画进行刷新控制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46854627/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4