dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Here your non-main thread.
[self.loading setHidden:NO];
dispatch_async(dispatch_get_main_queue(), ^{
//Here you returns to main thread.
[self.loading setHidden:NO];
});
});
这有效,但仍未隐藏:
[self.loading setHidden:NO];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Here your non-main thread.
dispatch_async(dispatch_get_main_queue(), ^{
//Here you returns to main thread.
[self.loading setHidden:NO];
});
});
如何在块内访问IBOutlets?
答案 0 :(得分:2)
你永远不会打电话给隐藏它的setHidden:YES
。另外,你对界面所做的任何事情都应该在主线程上进行。