UITapGestureRecognizer not work when I animate the UIImageView

前端 未结 2 1483
你的背包
你的背包 2021-02-20 14:02

When I want to animate the UIImageView, the UITapGestureRecognizer added to it can not work. WHY???

-(void) testTap:(id)sender {
    NS         


        
相关标签:
2条回答
  • 2021-02-20 14:42

    You need to allow user interaction during animation.

    UIViewAnimationOptions options = UIViewAnimationCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction;
    
    0 讨论(0)
  • 2021-02-20 14:58

    Just to add to this for Swift...something like this will work very well... Use .AllowUserInteraction.

    UIView.animateWithDuration(0.4, delay: 1.5, usingSpringWithDamping: 0.5, initialSpringVelocity: 20, options: UIViewAnimationOptions.AllowUserInteraction, animations:
                    {self.frame = originalFrame}, completion: nil)
    
    0 讨论(0)
提交回复
热议问题