模拟时间--延时处理

            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];
            }];
原文地址:https://www.cnblogs.com/mkai/p/7270243.html