下载地址:https://github.com/jdg/MBProgressHUD
网盘地址:http://pan.baidu.com/s/1dD6bFFV
使用说明:
1. 导入“MBProgressHUD” 的.h 和 .m 两个文件。
2. 根据Demo样式,自行选择。
3. 尝试使用CustomView这个样式。
3.1 导入头文件,代理。
3.2 直接COPY代码。
3.3 记得导入需要的图像。
做了一个保存图像的提示:
#pragma mark - 把图像保持相册
#pragma mark 保存图像
- (void)saveImageToPhotos: (UIImage *)saveImage
{
UIImageWriteToSavedPhotosAlbum(saveImage, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
}
#pragma mark 图像保存回调
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
//1. 初始化“第三方提示框”
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
[self.navigationController.view addSubview:HUD];
HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark"]] ;
HUD.mode = MBProgressHUDModeCustomView;
HUD.delegate = self;
//2. 提示信息
NSString * alertMsg = (error!=NULL ? @"图像存储失败" : @"图像存储成功");
HUD.labelText = alertMsg;
//3. 显示并设置几秒消失
[HUD show:YES];
[HUD hide:YES afterDelay:2];
}
显示:[HUD show:YES];
关闭: HUD.hidden = YES;
自动消失:[HUD hide:YES afterDelay:3]; //设置时间