views:

78

answers:

2

I have a UIViewController implementation which builds a core image cube and rotates it while there are touches events occuring. It has the following methods:

initController

touchesBegan

touchesMoved

touchesEnded

continueSpinning

I am trying to continue rotating the cube after the touchesEnded fires for an amount of time (say 2 seconds). I have created the continueSpinning method but I am unsure how to get the method to invoke without the touches methods e.g. on a timer.

I have tried calling continueSpinning from touchesEnded and sleeping the thread and recursively calling continueSpinning but this just animates when the thread returns (after the 2 seconds).

I need some way of invoking 'continueSpinning' similar to the touchesBegin methods.

Any ideas?

+1  A: 

if u put main thread in sleep mode .in that case iphone views will not reflect. because iphone view can only be changed by main thread. better to use NSTimer and set it to 2 sec

pawan.mangal
A: 

Call continue spinning in an repeating animation timer, and have the timer stop repeating after 2 seconds has elapsed from some start time.

hotpaw2