views:

555

answers:

3

hi im trying to execute 2 actions on occurrence of their particular events one is the animation occurring when the a timer with fixed interval is fired and other is also a animation occurring when a touch is detected

both r working fine individually but when simultaneously occurring anyone of the animation slows down .its because in the given time unit is performing only one action

for NSTimer im using time interval of 0.01s

How do make this scenario work without slowing down any animation?

A: 

Touches refusing to respond usually indicates a stressed CPU. Animating 100 times a second is probably the cause of that.

Kriem
A: 

I would also stop the timer from firing while the touch animation was in progress. You can call [timer invalidate] to stop the timer from firing. Maybe that would do the trick? Time interval of 0.05 would be much more reasonable, though - and may solve the problem entirely! Good luck!

Ben Gotow
+1  A: 

NSTimer is not the tool for performing animations. Core Animation is what you want for almost all animation problems on iPhone. NSTimer is not a real-time timer. It has not guarantees on when it fires. It's an excellent tool for many problems; animation is not one of them.

Rob Napier