In my iOS app I have lottie animation, which is on the whole screen. During animation user interactions are not available. I want to make everything under animation active to user interaction (scroll, buttons, etc.) Is there any chance to do it?
CODE:
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()
}
Did you tried adding gesture recognizers to Lottie view ?
Edit after code attach :
you can try add gestureRecognizer to animationView and add parameter (sender) on your function.
func handleTap(sender: UITapGestureRecognizer) {
if sender.state == .ended {
// handling code
}
}
I bet disabling user interaction for the animation view would do the trick. Try something like: animationView.userInteractionEnabled = false
. This should prevent touches from being consumed by the animationView
and not being propagated down the view hierarchy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.