I am new to iOS development, I have a question regarding timers. Suppose there is a certain timer that counts to nSec and then is destroyed, and the testMetod method. How can I determine if testMetod was called during a timer?
2 answers
In testMetod write:
NSLog(@"Hello I am testMetod") - I need to know whether it will be fulfilled or not precisely during this period of time. If I run, the program will execute method 1, if not then method 2. - Hudihka
- @Hudihka Make another timer that will check whether the variable flag has changed. If not, then perform method 2. - Ivan Kramarchuk
|
You say the timer is destroyed upon completion. Then you can do this: suppose your method is called testMethod, and the scope of the timer allows you to see it from the method body.
- (void)testMethod { if (timer) { // Зовёте метод 1 } else { // Зовёте метод 2 } // Код самого testMethod } |