在我的 iOS 应用程序中,我有整个屏幕上的 lottie 动画。在动画期间,用户交互不可用。我想让动画下的所有内容都对用户交互(滚动、按钮等)有效 有机会做吗?
代码:
guard let mainView = self?.view, let animationView = LOTAnimationView(name: "someName") else { return }
animationView.frame = CGRect(x: 0,
y: 0,
width: mainView.frame.size.width,
height: mainView.frame.size.height)
animationView.contentMode = .scaleAspectFill
animationView.loopAnimation = false
mainView.addSubview(animationView)
animationView.play() { _ in
animationView.removeFromSuperview()
}
最佳答案
我打赌禁用动画 View 的用户交互会成功。尝试类似的东西:
animationView.userInteractionEnabled = false
。这应该可以防止触摸被 animationView
消耗并且不会向下传播到 View 层次结构中。
关于ios - Lottie 在 iOS 上与用户交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52331389/