Threading
Sample Format:Step .1
[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil];
Step .2
- (void)myMethod { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
*** code that should be run in the new thread goes here ***
[pool release]; }
Step .3
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:false];
Step .2
- (void)myMethod { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
*** code that should be run in the new thread goes here ***
[pool release]; }
Step .3
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:false];
No comments:
Post a Comment