swift - 当 UIViewPropertyAnimator 运行时,具有按钮的子视图的 ScrollView 不可点击
问题描述
我正在使用 scrollView 和 UIViewPropertyAnimator.runningPropertyAnimator 制作幻灯片动画,但我面临子视图按钮不可点击的问题,为了验证它是否来自动画,我停止了动画代码并且按钮开始触发它们的动作
下面是我正在使用的代码
UIViewPropertyAnimator.runningPropertyAnimator(withDuration: Double(4 * self.data.count), delay: 0, options: .allowUserInteraction, animations: {
guard self.data.count > 0 else { return }
self.scrollView.contentOffset.x = self.cells[self.cells.count - 1].frame.maxX
}) { (animatingPositionView) in
switch animatingPositionView {
case .current:
break
case .end:
if self.scrollView.contentOffset.x == self.cells[self.cells.count - 1].frame.maxX {
self.scrollView.contentOffset.x = -self.frame.width
self.startScrolling()
}
case .start:
break
@unknown default:
break
}
}
解决方案
推荐阅读
- typescript - 在 Typescript 中使用函数作为一等值时,有没有办法传递通用绑定?
- python - 使用 Altair,我如何创建一个矩形颜色层?
- c - 在c中计算校验和(16位)
- reactjs - 反应三纤维和Textureloader不显示
- php - 如何将计费详细信息添加到源 Stripe API
- c# - Google API Auth2 - C# .net 核心
- rust - 对列表列表进行重复数据处理与借用检查器发生冲突
- c# - 如何使用 C# 和 .NET Core 制作转码视频文件流
- sql-server - Flutter 通过身份验证上传和检索资产
- uwp - 无法测试 Windows.Services.Store 命名空间