iOS 进度框(二) SVProgressHUD
来源:互联网 发布:沪金td数据从哪能下载 编辑:程序博客网 时间:2024/05/17 07:43
一、常用的第三方 “进度框” 大致有以下2种:
(1)SVProgressHUD 使用起来很方便,但可定制差一些,看它的接口貌似只能添加一个全屏的HUD,不能把它添加到某个视图上面去。SVProgressHUD 调用方式很多都是静态方式,使用起来也比较方便。
(2)MBProgressHUD 功能全一些,可定制高一些,而且可以指定加到某一个View上去,用起来可能就没上面那个方便了。
github 地址 https://github.com/samvermette/SVProgressHUD
MBProgressHUD 在我的上一篇博客中已经介绍过了,这里介绍一下SVProgressHUD
当前开发环境 Mac OS 10.11.6、XCode 7.1、iOS9
SVProgressHUD的版本为 v2.0.3
二、项目截图
1、运行截图
2、show
- (void)show {[SVProgressHUD show];}
3、showWithStatus
- (void)showWithStatus {[SVProgressHUD showWithStatus:@"Doing Stuff"];}
4、showWithProgress
static float progress = 0.0f;- (IBAction)showWithProgress:(id)sender { progress = 0.0f; [SVProgressHUD showProgress:0 status:@"Loading"]; [self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3f];}- (void)increaseProgress { progress += 0.1f; [SVProgressHUD showProgress:progress status:@"Loading"]; if(progress < 1.0f){ [self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3f]; } else { [self performSelector:@selector(dismiss) withObject:nil afterDelay:0.4f]; }}
5、showInfoWithStatus
- (IBAction)showInfoWithStatus { [SVProgressHUD showInfoWithStatus:@"Useful Information."];}
6、showSuccessWithStatus
- (void)showSuccessWithStatus {[SVProgressHUD showSuccessWithStatus:@"Great Success!"];}
7、showErrorWithStatus
- (void)showErrorWithStatus {[SVProgressHUD showErrorWithStatus:@"Failed with Error"];}
8、dismiss
关闭进度框
- (void)dismiss {[SVProgressHUD dismiss];}
9、Style(Light、Dark)
Style指的是背景颜色,背景色与前景色相反。
typedef NS_ENUM(NSInteger, SVProgressHUDStyle) { SVProgressHUDStyleLight, // default style, white HUD with black text, HUD background will be blurred on iOS 8 and above SVProgressHUDStyleDark, // black HUD and white text, HUD background will be blurred on iOS 8 and above SVProgressHUDStyleCustom // uses the fore- and background color properties};
例如:
(1)SVProgressHUDStyleLight:White background with black spinner and text
背景色为白色,前景色为黑色
(2)SVProgressHUDStyleDark:Black background with white spinner and text
背景色为黑色,前景色为白色
(3)SVProgressHUDStyleCustom:
If you want to use custom colors with setForegroundColor and setBackgroundColor don't forget tp set SVProgressHUDStyleCustom via setDefaultStyle
如果想使用自定义的前景色和背景色,就必须使者该style。
10、AnimationType(Flat、Native)
AnimationType指的是动画类型,只对 "show" 和 "showWithStatus" 有效
typedef NS_ENUM(NSUInteger, SVProgressHUDAnimationType) { SVProgressHUDAnimationTypeFlat, // default animation type, custom flat animation (indefinite animated ring) SVProgressHUDAnimationTypeNative // iOS native UIActivityIndicatorView};
(1)Flat
(2)Native
11、MaskType(None、Clear、Black、Grad、Cust)
typedef NS_ENUM(NSUInteger, SVProgressHUDMaskType) { SVProgressHUDMaskTypeNone = 1, // default mask type, allow user interactions while HUD is displayed SVProgressHUDMaskTypeClear, // don't allow user interactions SVProgressHUDMaskTypeBlack, // don't allow user interactions and dim the UI in the back of the HUD, as on iOS 7 and above SVProgressHUDMaskTypeGradient, // don't allow user interactions and dim the UI with a a-la UIAlertView background gradient, as on iOS 6 SVProgressHUDMaskTypeCustom // don't allow user interactions and dim the UI in the back of the HUD with a custom color};
(1)None 表示无背景,单击 "进度框“ 以外的区域可以将事件传递给下层(非模态)
(2)Clear 表示背景透明,阻塞 “进度框” 以外的事件传递(模态)
(3)Black 表示背景为黑色,阻塞 “进度框” 以外的事件传递(模态)
(4)Grad 表示背景为渐变色(中间白,四周黑),阻塞 “进度框” 以外的事件传递(模态)
(5)Cust 表示背景为红色,阻塞 “进度框” 以外的事件传递(模态)
- iOS 进度框(二) SVProgressHUD
- iOS进度提示组件 MBProgressHUD、SVProgressHUD
- iOS——加载进度示的SVProgressHUD 用法
- [IOS]SVProgressHUD
- iOS----SVProgressHUD
- iOS提示框之 MBProgressHUD 与 SVProgressHUD
- SVProgressHUD–比MBProgressHUD更好用的 iOS进度提示组件
- iOS:SVProgressHUD控件使用
- iOS SVProgressHUD 简单使用
- iOS SVProgressHUD 用法
- iOS ----- MBProgressHUD、SVProgressHUD基本使用方法
- svprogresshud
- SVProgressHUD
- SVProgressHUD
- SVProgressHUD
- SVProgressHUD
- iOS开发——MBProgressHUD 与 SVProgressHUD iOS提示框的优缺点
- iOS 进度框(一) MBProgressHUD
- Android 左右滑屏 方向判断 ViewPager
- Java干货之回头补基础(一) ——Callback机制个人理解及应用
- 多线程并发的cache实现
- Cubietruck---11. Linux3.3_serail串口驱动分析
- iOS 角度与弧度的转换
- iOS 进度框(二) SVProgressHUD
- Android开发---ListView实现局部刷新及删除
- JSP九大内置对象及四个作用域
- 浅谈magic-check——美化单选款、复选框
- 10分钟理解 - GIT or GIT 实战
- oracle出现IOU 10150错误,要彻底删除oracle注册信息
- php 新浪微博第三方登录验证/OAuth2.0
- Cubietruck---12. boot1源码流程简略分析
- Android Studio如何取消与SVN的关联