OC 线程操作2 - NSThread

- (void)createNSThread111{

/*   

参数1: (nonnull id) 目标对象 self

参数2:(nonnull SEL) 方法选择器 ,调用的方法

参数3:(nullable id) 前面调用方法需要传递的参数 nil

*/

//1.创建线程 NSThread *thread= [[NSThread alloc] initWithTarget:self selector:@selector(run:) object:@"abc"];

//2.开启线程 [thread start];

}

- (void)run:(NSString *)pama{

NSLog(@"---fun---%@", [NSThread currentThread]);

}

猜你喜欢

转载自www.cnblogs.com/qingzZ/p/9212734.html
今日推荐