Run method in background

by alex 15. April 2009 01:49

[NSThread detachNewThreadSelector:@selector(doSomethingInBack:) toTarget:self withObject:nil];

 

-(void) doSomethingInBack:(id)anObject {

NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];

 

//place code you want to run in different thread HERE

 

[NSThread exit];

//we need to do this to prevent memory leaks

[autoreleasepool release];

}

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen