Guest User

Untitled

a guest
Apr 24th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. @interface timerClass : NSObject {
  2. int count;
  3. }
  4. -(void)printf:(NSTimer *)timer;
  5. @end
  6. @implementation timerClass
  7. -(void)printf:(NSTimer *)timer
  8. {
  9. count++;
  10. if(count < 10)
  11. printf("Called");
  12. }
  13. @end
  14. int main(int argc, char *argv[])
  15. {
  16. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  17.  
  18. NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:[[[timerClass alloc] init] autorelease] selector:@selector(printf:) userInfo:nil repeats:YES];
  19. [[NSRunLoop currentRunLoop] run];
  20.  
  21. [pool drain];
  22. return 0;
  23. }
Add Comment
Please, Sign In to add comment