When I click a UIButton, say b1, two random values, x and y, are generated which become the new coordinates of another UIButton, say b2. b2 slowly moves to the required position (using +[UIView animateWithDuration: animations:] ). Now what I want to happen is: while b2 is in motion, clicking b1 again should move b2 to the new coordinates. What’s happening right now is that I’m unable to click on b1 until b2 is nicely settled in the generated position. Any insights?
When I click a UIButton , say b1 , two random values, x and
Share
You’ll want to use
instead. And set
UIViewAnimationOptionAllowUserInteractionin the options so that iOS doesn’t block user interaction when the animation is occurring.You’ll also want to set
UIViewAnimationOptionBeginFromCurrentStateso that the button begins at the current state.