两种NSThread创建方式

1.第一种方式

//创建线程
NSThread *thread=[[NSThread alloc]initWithTarget:self selector:@selector(act1) object:nil];
//启动线程
[thread start];

2.第二种方式,创建并启动线程

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

你可能感兴趣的:(两种NSThread创建方式)