IOS-NSThread

196 阅读1分钟

NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(demo:) object:@"hello NSThread"];
    [thread start];
    
[NSThread detachNewThreadSelector:@selector(demo:) toTarget:self withObject:@"hello NSThread2"];

[self performSelectorInBackground:@selector(demo:) withObject:@"hello NSThread3"];

- (void)demo:(NSString *)name {
    
    NSLog(@"param %@", name);
}