目前找到一个办法:
- (void)evTouchUpInside:(id)sender {
NSLog(@"before dispathc_async");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSLog(@"1 dispathc_async");
// 耗时的操作
[NSThread sleepForTimeInterval:3];
dispatch_async(dispatch_get_main_queue(), ^{
// 更新界面
NSLog(@"2 dispathc_async");
});
});
NSLog(@"after dispathc_async");
}
希望能抛砖引玉,, 不知道各位还有什么更好的办法
- (void)evTouchUpInside:(id)sender {
NSLog(@"before dispathc_async");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSLog(@"1 dispathc_async");
// 耗时的操作
[NSThread sleepForTimeInterval:3];
dispatch_async(dispatch_get_main_queue(), ^{
// 更新界面
NSLog(@"2 dispathc_async");
});
});
NSLog(@"after dispathc_async");
}
希望能抛砖引玉,, 不知道各位还有什么更好的办法
那你应该把Button的事件让TableView的Controller来处理