iphone - Repeating self performSelector -


I was just wandering if there is a simple way to repeat the code below for 20 seconds if there is how?

  [self display selector: @sillector (move 1) withObject: after zero: 1 9]; [Self display selector: @Selector (move 2) withObject: zero after: 0.2]; [Self Performance Selector: @Selector (Hill 3) withObject: After zero: 1 9]; [Self Performance Selector: @Selector (move1) withObject: After zero: 0.8]; [Self display selector: @Selector (move 2) withObject: after zero: 0.10]; [Self Performance Selector: @Selector (Hill 3) withObject: After zero: 0.12]; According to my opinion just try this code below,    

P> Take an NSIFF file in your controller's .h file, e.g.,

  NSINTGir intemp;   

Call NSTimer method in .m file this way,

  [NSTimer Scheduled Timer with Time Interface: 1.0 Target: Self Selector: @Selector ( TestMethod :) userInfo: zero repeats: yes];   

and type the selector like this

  - (zero) testMethod: (NSTimer *) pTmpTimer {intTmp + = 1; If (intamMP and lieutenant; = 20) {[self-demonstrating: object with the @ selector (move 1): after zero: della: 0.0]; [Self display selector: @Selector (move 2) withObject: zero after: 0.2]; [Self Performance Selector: @Selector (Hill 3) withObject: After zero: 1 9]; [Self Performance Selector: @Selector (move1) withObject: After zero: 0.8]; [Self display selector: @Selector (move 2) withObject: after zero: 0.10]; [Self Performance Selector: @Selector (Hill 3) withObject: After zero: 0.12]; } Other {[PTMP timer invalid]; IntTmp = 0; }}   

With the above code, testMethod will call 20 times and repeat your code 20 times as per your requirement.

Hope this works for you.

Happy coding ..

Comments