导入三方库MBProgressHUD github地址:https://github.com/jdg/MBProgressHUD
调用以下代码即可实现清除缓存
[HUD hide:YES afterDelay:0.5];
动画持续时间
#pragma -mark 清理缓存
-(void)clear
{
HUD = [[MBProgressHUD alloc] init];
UIWindow *V=[[[UIApplication sharedApplication] delegate] window];
HUD = [[MBProgressHUD alloc] init];
[V addSubview:HUD];
HUD.mode = MBProgressHUDModeAnnularDeterminate;
HUD.delegate = self;
HUD.labelText = @"清理中...";
[HUD showAnimated:YES whileExecutingBlock:^{
[self myProgressTask];
} completionBlock:^{
[HUD removeFromSuperview];
HUD = nil;
HUD = [[MBProgressHUD alloc] init];
[V addSubview:HUD];
HUD.mode = MBProgressHUDModeCustomView;
HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
HUD.labelText = @"完成";
[HUD show:YES];
[HUD hide:YES afterDelay:0.5];
}];
}