Possible Duplicate:
Execute an “if” condition “x” milliseconds and stop for “y”millisecond and repeat the condition ?
I have a program that test a condition inside a if loop continuously during the run of the programme. But i want this if condition to become true or active for certain period of time(say for 5ms) and then deactivate the if condition for next 10ms. Then continue this pattern continuously until user close the program!
Although it sounds like you should really take a different approach, this is the answer to your question literally:
This loop will be very detrimental to app performance and battery life.
Depending on what kind of code has to be executed “for 5 ms, every 15 ms”, you could use an
NSTimerinstead:with a method: