- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES]; hud.dimBackground = YES;
//block main线程 代码原本在此, 但因为这个方法(块)执行完之前, 画图的代码没有机会执行,所以MBProgressHUD没法被画出来,
//所以要想办法 让这段代码执行完,有画图的机会,然后在回到主线程去执行 那种必须在主线程执行的代码(pushViewController)
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
NSString *filename = [[self fileList]objectAtIndex:indexPath.row];
ViewController *browserController = [[ViewController alloc] initWithFileName:filename];
browserController.title = filename ;
[[self navigationController] pushViewController:browserController animated:YES];
[browserController release];
[MBProgressHUD hideHUDForView:self.navigationController.view animated:YES];
});
});
}
分享到:
相关推荐
IOS开源的MBProgressHUD,可以进行快速的集成
MBProgressHUD二次封装
不一样的MBProgressHUD,为了使用更方便,下面对它进行扩展,可在加载界面时直接退出该界面,简单好用
可以轻轻松松管理MBProgressHUD,一键调用HUD显示及隐藏等,调用代码如下。 [MBProgressHUD showActivityMessageInWindow:nil]; [MBProgressHUD showActivityMessageInView:nil]; [MBProgressHUD ...
网络请求是使用到的等待视图MBProgressHUD
MBProgressHUD封装,直接使用方便快捷。
MBProgressHUD网络加载视图
使用Swift封装MBProgressHUD,方便在swift中调用,采用源码导入,方便开发者自定义格式内容等
简化MBProgressHUD github: https://github.com/MarkeJave/MBProgressHUD-Extension.git
iOS--MBProgressHUD第三方的弹框
MBProgressHUD的使用,临时总结了几款最常用的使用场景 源码下载:https://github.com/TangledHusky/YJProgressHUD 使用说明:http://www.cnblogs.com/yajunLi/p/5822702.html 1、提示消息 用法: ...
给MBProgressHUD写的工具类,里面有很多方法,解决了MB存在的很多问题,很好用
IOS应用源码之【类库与框架】MBProgressHUD.rar
NULL 博文链接:https://auauau.iteye.com/blog/575415
MBProgressHUD是很好用的第三方控件
ios 第三方类 比较全的 等待加载的效果
该类文件实现了iphone的加载等待效果,与苹果官方sdk的api中的UIActivityIndicatorView类相比,用户体验更好