How to implement threading in iPhone SDK
1. Create the new thread:
[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil];
2. Create the method that is called by the new thread:
- (void)myMethod { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Thread code here [pool release]; }
If you need to do something to the main thread from inside your new thread
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:false];
Log in to answer.
leothenerd 1:36 pm on December 21, 2009
1. Create the new thread:
2. Create the method that is called by the new thread:
If you need to do something to the main thread from inside your new thread