Guest User

Untitled

a guest
Jul 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1.  
  2. - (void)methodToRunInBackgroundThread:(id)object {
  3. // Create this thread's pool
  4. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  5.  
  6. // Do stuff here...
  7.  
  8.  
  9. // And when you're done you'll probably want to update your view but you have to do that on the main thread
  10. // Bundle up whatever you're sending into a NSArray or something and pass that to another method
  11. [self performSelectorOnMainThread:@selector(doOnMainThread:) withObject:@"stuff" waitUntilDone:NO];
  12.  
  13. // Release the pool, thread is done
  14. [pool release];
  15. }
Add Comment
Please, Sign In to add comment