模拟时间--延时处理

            MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
            [self.navigationController.view addSubview:hud];
            hud.labelText = @"正在清除缓存....";
            __weak typeof (self)weakSelf = self;
            [hud showAnimated:YES whileExecutingBlock:^{
                // 模拟删除 要时间
                sleep(1.0);
            } completionBlock:^{
//                [[NSNotificationCenter defaultCenter] postNotificationName:@"CLEARHISTORYTABLE" object:nil];
                [hud removeFromSuperview];
                NSString *clearCacheName =  [weakSelf clearTmpPics];
                [JZGProgressHUD showInfoWithText:@"清理成功" toView:self.view];
                weakSelf.cacheLabel.text = clearCacheName;
                [weakSelf.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:[NSIndexPath indexPathForRow:3 inSection:0], nil] withRowAnimation:UITableViewRowAnimationNone];
            }];

 

posted @ 2017-08-01 19:22  超神船长  阅读(154)  评论(0编辑  收藏  举报