Home UIView.animate with allowUserInteraction enables the UIButton only in the animation's final frame
Reply: 0

UIView.animate with allowUserInteraction enables the UIButton only in the animation's final frame

user768
1#
user768 Published in June 20, 2018, 10:41 pm

If I'm animating a UIButton and use the .allowUserInteraction option, the area of the final frame at the end of the animation can be tapped to interact with the button, even before the button has made it to that frame. Tapping where the button is visible does not trigger the action if it is outside of the final frame the button is animating toward:

UIView.animate(withDuration: 9.0, delay: 0.0, options: [.curveLinear, .allowUserInteraction], animations: {
            self.theButton.frame = CGRect(x: (self.view.frame.width * 0.1), y: self.theButton.frame.origin.y, width: self.theButton.frame.width, height: self.theButton.frame.height)

        }, completion: nil)

Any help would be greatly appreciated. Thanks!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.316823 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO