1.第一種方式
//創(chuàng)建線程
NSThread *thread=[[NSThread alloc]initWithTarget:self selector:@selector(act1) object:nil];
//啟動線程
[thread start];
2.第二種方式,創(chuàng)建并啟動線程
[NSThread detachNewThreadSelector:@selector(act2) toTarget:self withObject:nil];
1.第一種方式
//創(chuàng)建線程
NSThread *thread=[[NSThread alloc]initWithTarget:self selector:@selector(act1) object:nil];
//啟動線程
[thread start];
2.第二種方式,創(chuàng)建并啟動線程
[NSThread detachNewThreadSelector:@selector(act2) toTarget:self withObject:nil];