ios - Lottie 与 iOS 上的用户交互
问题描述
在我的 iOS 应用程序中,我有乐天动画,它在整个屏幕上。在动画期间,用户交互不可用。我想让动画下的所有内容都对用户交互(滚动、按钮等)处于活动状态。有没有机会做到这一点?
代码:
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()
}
解决方案
我敢打赌,禁用动画视图的用户交互就可以了。尝试类似:
animationView.userInteractionEnabled = false
。这应该防止触摸被 消耗animationView
并且不会被向下传播到视图层次结构中。
推荐阅读
- c# - 使用 IP 地址打印时以编程方式更改打印机设置
- modelsim - vlog-7 错误。无法以读取模式打开设计单元文件
- javascript - 基于 URL 的 React 组件状态
- mysql - 如果字段不为空,MySQL 添加 where 子句
- sql - 如何比较表的多列和多行
- outlook - 展望:每月的第三个星期五设置一次定期会议
- bash - 如何将命令传递给包含管道的 xargs?
- rust-diesel - Diesel 获取单亲和许多孩子 - 火箭
- go - golang io.writer 写完字符串后换行
- javascript - 猫鼬连接:在中间件中调用连接之间的不同行为