A
NSThread example that is very simple.
Let's create and run a NSThread object on iPhoneOS.
First you should write a method that runs as a thread [
NSThread Example]
1 | -( void ) myTestThread:(id)anObject { |
3 | NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
6 | [autoreleasepool release]; |
Then create a new NSThread object with detachNewThreadSelector method as following
code fragment. That's all pretty simple! [
NSThread Example]
[NSThread detachNewThreadSelector:@selector(myTestThread:) toTarget:self withObject:nil];