select 选项卡时是否可以将 Lottie 动画添加到 UITabbarViewController?

Is it possible to add Lottie animation to UITabbarViewController when select tab?

现在,我有 tabbar 图标的 lottie 文件动画,但是当 select tab 成为动画视图时我不知道如何放置它。

有没有人可以帮助我解决这个问题或者指导我? 谢谢。

导入 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)