摘要:
使用runloop阻塞线程的正确写法runloop可以阻塞线程,等待其他线程执行后再执行。比如:@implementation ViewController{ BOOL end;}…– (void)viewDidLoad{ [super viewDidLoad]; NSLog(@”start new thread …”); [NSThread detachNewThreadSelector:@selector(runOnNewThread) toTarget:self withObject:nil]; while (!end) { NSLog(@”runloop…”); ... 阅读全文