Reputation: 16051
I have a UIView following the users finger as they move it around inside my app. Sometimes, other things on screen are animating with UIViewAnimation blocks, but this freezes the tracking of their finger, so if they continue moving their finger during the animation, it won't follow. How can i stop the animation from blocking up the main thread?
Upvotes: 4
Views: 996
Reputation: 535169
Note that if you link for iOS 5 this problem will go away all by itself. Under iOS 5, block-based animation of a view does not turn off user interaction for other views. This is what Apple should have done in the first place.
Upvotes: 0
Reputation: 1496
Try using UIViewAnimationOptionAllowUserInteraction
with [UIView animateWithDuration:delay:options:animations:completion:]
Upvotes: 10
Reputation: 4761
you can use the NSObject's method: performSelector:onThread:withObject:waitUntilDone:
More details in Apple NSObject Documentation
Upvotes: 1
Reputation: 17478
If there is any other thing on the screen is animated, that would also be done in main thread. And the current finger tracking would also be done in main thread. So definitely there would be some blocking.
To get rid of that, we can optimize our code using blocks and GCD.
Upvotes: 0