iOS_第3方类库MBprogressHUD
2014-08-06 18:22
309 查看
1,将下载好的第3方类库MBprogressHUD源码包加入到工程(其实就是一个.h和.m文件)
2,进入工程的Build Phases,将源码包里面的所有.m文件全部添加到工程
3,添加第3方类库的主头文件"MBProgressHUD.h"
显示代码:
自定义显示图片:
2,进入工程的Build Phases,将源码包里面的所有.m文件全部添加到工程
3,添加第3方类库的主头文件"MBProgressHUD.h"
显示代码:
// 一开始加载就,显示提示条 MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:webView animated:YES]; // 加一层蒙版 hud.dimBackground = YES; hud.labelText = @"页面加载中...";隐藏代码:
// 一旦加载完毕,就隐藏提示条 [MBProgressHUD hideAllHUDsForView:webView animated:YES];
自定义显示图片:
// 抽取的,仅供分类内部调用 + (void) showMsg:(NSString *)msg imgName:(NSString *)imgName { // 显示到主窗口中 MBProgressHUD *hud =[MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES]; // 显示模式,改成customView,即显示自定义图片(mode设置,必须写在customView赋值之前) hud.mode = MBProgressHUDModeCustomView; int delay = 1; if ([imgName isEqualToString:@"error.png"]) { // 错误时,提示3秒钟 delay = 3; } imgName = [NSString stringWithFormat:@"MBProgressHUD.bundle/%@",imgName]; // 设置要显示 的自定义的图片 hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imgName]]; // 显示的文字,比如:加载失败...加载中... hud.labelText = msg; // 标志:必须为YES,才可以隐藏, 隐藏的时候从父控件中移除 hud.removeFromSuperViewOnHide = YES; // 3秒后自动隐藏 log(@"%d",delay); [hud hide:YES afterDelay:delay]; }其他常用属性
// 提示框的背景色 hud.color = [UIColor clearColor];//这儿表示无背景 // 提示下文的小文字 hud.detailsLabelText = @"detail"; // 阴影遮罩效果 hud.dimBackground = YES; // 1秒之后隐藏 [hud hide:YES afterDelay:1]; //只显示文字 hud.mode = MBProgressHUDModeText; // 外边距 和 Y方向偏移 hud.margin = 0; hud.yOffset = 0; // 隐藏后从父控件中移除 hud.removeFromSuperViewOnHide = YES; //圆形进度条 hud.mode = MBProgressHUDModeAnnularDeterminate;
相关文章推荐
- iOS_第3方类库MBprogressHUD
- IOS上的几个类库:MBProgressHUD、ASIHttpRequest、JSON Framework和Flurry
- iOS_第3方类库SDWebImage
- IOS上的几个类库:MBProgressHUD、ASIHttpRequest、JSON Framework和Flurry
- iOS_第3方类库_侧滑选项卡SlideSwitchView
- iOS_第3方类库_BlurAlertView_GPUImage
- iOS_第3方类库SDWebImage简单使用
- IOS上的几个类库:MBProgressHUD、ASIHttpRequest、JSON Framework和Flurry
- iOS_第3方类库_EGOImageView异步加载网络图片
- IOS上的几个类库:MBProgressHUD、ASIHttpRequest、JSON Framework和Flurry
- iOS_第3方类库_BlurAlertView_GPUImage
- iOS_第3方类库_側滑选项卡SlideSwitchView
- iOS高效开发必备的10款Objective-C类库
- iOS高效开发必备的10款Objective-C类库
- 10款iOS高效开发必备的Objective-C类库
- 10款iOS高效开发必备的Objective-C类库
- IOS开发UI篇之──自定义加载等待框(MBProgressHUD)
- iOS 里查找中文首字母的类库
- 10款iOS高效开发必备的Objective-C类库
- 10款iOS高效开发必备的Objective-C类库