Very beginner obj-c question.
My task is to do simple sequence when view loads:
- pause 2 secons
- method1 execution
- pause 2 seconds
- method2 execution
- pause 2 seconds
- method3 execution
I write this code for iOS5+ so blocks or other features can be used. I tried
[NSThread sleepForTimeInterval:x];
to make the pauses between methods executions, but three pauses added to one and I have one big pause, so it’s wrong piece.
How to do this in right way?
Sleeping an NSThread is never the right way to handle timed method execution. You want NSTimer, which you can set to either fire the same method after two seconds (then have that method determine which selector to perform next), or have three timers set to fire two seconds after each other, each calling a different method.