首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

MBProgressHUD 画不出来解决方法

2012-06-29 
MBProgressHUD 画不出来解决办法??- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:

MBProgressHUD 画不出来解决办法

?

?

- (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];        });     });}

热点排行