Guest User

Untitled

a guest
Jul 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1.  
  2. - (void)startAnimation
  3. {
  4. NSThread* timerThread = [[NSThread alloc] initWithTarget:self selector:@selector(startAnimationThread) object:nil]; //Create a new thread
  5. [timerThread start]; //start the thread
  6. }
  7.  
  8. //the thread starts by sending this message
  9. -(void) startAnimationThread
  10. {
  11. NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
  12. NSRunLoop* runLoop = [NSRunLoop currentRunLoop];
  13. [[NSTimer scheduledTimerWithTimeInterval: animationInterval
  14. target: self
  15. selector: @selector(drawView)
  16. userInfo: nil
  17. repeats: YES] retain];
  18.  
  19. [runLoop run];
  20. [pool release];
  21. }
Add Comment
Please, Sign In to add comment