判断是否在主线程执行
//隐藏加载框
+ (void)hiddenLodingHUDFromView:(UIView *)view animated:(BOOL)animated
{
if ([[NSThread currentThread] isMainThread]) {
[MBProgressHUD hideHUDForView:view animated:animated];
} else {
dispatch_sync(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:view animated:animated];
});
}
}
网友评论