【问题标题】:Is it possible to add Lottie animation to UITabbarViewController when select tab?选择选项卡时是否可以将 Lottie 动画添加到 UITabbarViewController?
【发布时间】:2021-08-10 10:38:17
【问题描述】:

现在,我有标签栏图标的Lottie文件动画,但我不知道如何将它放在选择标签作为动画视图时。

有没有人可以帮助我或者只是指导我? 谢谢。

【问题讨论】:

标签: ios swift uitabbarcontroller uitabbar lottie


【解决方案1】:

导入 Lottie 后创建这些函数:

func showLoadingAnimation(view: UIView) {
    animationView.isHidden = false
    animationView.animation = Animation.named("53175-ball-spinner")
    animationView.frame = CGRect(x: 0, y: 0, width: 80, height: 80)
    animationView.center = view.center
    animationView.contentMode = .scaleAspectFill
    animationView.loopMode = .loop
    animationView.play()
    view.addSubview(animationView)
}

func hideLoadingAnimation() {
    animationView.stop()
    animationView.isHidden = true
}

在需要的地方给他们打电话:

showLoadingAnimation(view: self.view)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-10
    • 2019-07-12
    • 1970-01-01
    • 2012-05-10
    • 1970-01-01
    • 2016-12-30
    相关资源
    最近更新 更多