//方法1:
NSString *obj = [NSString stringWithFormat:@"子线程"];
[NSThread detachNewThreadSelector:@selector(test:) toTarget:self withObject:obj]; /test: 为自定义方法,可以根据自己需要定义,这种方法创建的线程,创建的时候就自动跑
//方法2:
NSThread *mythread = [[NSThread alloc]initWithTarget:self selector:@selector(test:) object:obj]; //这种方法创建的线程需要调用start以后才会执行
[mythread start];
//方法3:
[self performSelectorInBackground:@selector(test:) withObject:nil]; //改方法为在父进程的背景下执行,若不传递参数withobject处可以写nil