我的线程遇到了一些问题。目前,showInstructions
提出的视图在线程完成之前被禁用...如何在线程进行时将其设置为交互式?
提前致谢!
[self performSelectorOnMainThread:@selector(loadEverything) withObject:self waitUntilDone:YES];
-(void)loadEverything {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[self performSelector:@selector(showInstructions)];
[self performSelector:@selector(loadStats)];
[self performSelector:@selector(animate_sideBTN)];
[self performSelector:@selector(loadNIBs)];
[self performSelector:@selector(incrementStats)];
[NSThread detachNewThreadSelector:@selector(loadMap) toTarget:self withObject:nil];
[[self.view viewWithTag: 123] removeFromSuperview];
[pool drain];
}
答案 0 :(得分:1)
请尝试调用 - (void)loadEverything in“performSelectorOnMainThread”并从该调用[NSThread detachNewThreadSelector:]进行操作,这些操作不会影响UI组件,[self performSelector]会影响UI组件。
答案 1 :(得分:0)
我认为你应该学习一些GCD并在一个块内做相同的代码。或者使用NSOperation ......如果可能,请避免使用线程。