0

I made an animation and my imageviews slide right to left edge with UIView.animate. I want to tap the image views during animation but I can't.

By the way, cloud is a container view with the imageviews. I will give animation to container view.

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)
    })
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Akif Demirezen
  • 191
  • 1
  • 1
  • 13

0 Answers0