您的位置:首页 > 移动开发 > IOS开发

ios清除缓存

2016-03-14 16:09 471 查看
导入三方库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];
}];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS