ios - 当动画Swift时,点击手势在UIImageview上不起作用
问题描述
我制作了一个动画,我的图像视图使用 UIView.animate 从右向左滑动。我想在动画期间点击图像视图,但我不能。
顺便说一下,cloud
是一个带有 imageviews 的容器视图。我会给容器视图动画。
tapImage = UIPanGestureRecognizer(target: self, action:#selector(goToDetail))
self.imgView1.addGestureRecognizer(tapImage!)
func animateTheClouds(cloud : UIView) {
let cloudMovingSpeed = 3.0/view.frame.size.width
let duration = (cloud.frame.origin.x + cloud.frame.size.width) * cloudMovingSpeed
UIView.animate(withDuration: TimeInterval(duration), delay: 0.0, options: [.curveLinear,.allowUserInteraction,.allowAnimatedContent], animations: {
cloud.frame.origin.x = -cloud.frame.size.width
}, completion: {_ in
// Reset back to the right edge of the screen
if cloud.frame.origin.x <= 0{
self.createGroupKanjiList()
self.setImages()
cloud.frame.origin.x = self.view.frame.size.width
}
self.animateTheClouds(cloud: cloud)
})
}
解决方案
推荐阅读
- android - PlacePicker 在启动时立即关闭
- jenkins - 是否可以稍后在脚本部分中从声明性 Jenkinsfile 引用“代理”容器?
- react-native - React Native:无法导入csv文件
- xamarin - 如何在 Xamarin 表单的标签上使用 textcolor?
- api - Google Maps API 地图集群图像不会显示
- maven - 是否可以在 Maven 读取项目之后和生命周期开始之前运行脚本
- angular - 重定向页面时量角器执行挂起
- html - 如何区分 CSS 和 HTML 中相同的选中元素
- python - Extracting data from html using BeautifulSoup in Python
- iis - \\?\C: 是什么意思?