SVProgressHUD 用法一

SVProgressHUD 用法一 

SVProgressHUD 是一个第三方的控件,是一个弹出提示层,用来提示 网络加载 或 提示对错,看下面图,你就明白了:

那么,SVProgressHUD 都有什么特点呢:

1. 提示当前的状态,如:网络传输、提交中、操作成功或失败等等.

2. 可是设置提示的 pop layer 是否为 model,就是,提示的时间是否允许用户做其他操作

3. 可以设置 背景色 和 自定义提示的内容

4. 使用起来非常简洁,代码量非常少

那么如何使用 SVProgressHUD 呢:

1. 官网下载代码,并放入到项目中

2. 在使用到的 项目 里面,加入引用  #import "SVProgressHUD.h"

3. 在需要提示的地方,加入调用代码 ,如:

[SVProgressHUD showWithStatus:@"加载中..." maskType:SVProgressHUDMaskTypeGradient]

4. 在需要隐藏的地方,加入隐藏当前提示的代码,如:[SVProgressHUD dismiss]

SVProgressHUD 常用方法介绍:

1. + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType 调用 SVProgressHUD,并自定义 提示的内容 和 提示层的样式

2. + (void)dismiss 关闭当前提示

SVProgressHUDMaskType 介绍:

1. SVProgressHUDMaskTypeNone : 当提示显示的时间,用户仍然可以做其他操作,比如View 上面的输入等

2. SVProgressHUDMaskTypeClear : 用户不可以做其他操作

3. SVProgressHUDMaskTypeBlack : 用户不可以做其他操作,并且背景色是黑色

4. SVProgressHUDMaskTypeGradient : 用户不可以做其他操作,并且背景色是渐变的

SVProgressHUD 全部方法:

+ (void)show;
+ (void)showWithStatus:(NSString*)status;
+ (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType;
+ (void)showWithMaskType:(SVProgressHUDMaskType)maskType;

+ (void)showSuccessWithStatus:(NSString*)string;
+ (void)showSuccessWithStatus:(NSString *)string duration:(NSTimeInterval)duration;
+ (void)showErrorWithStatus:(NSString *)string;
+ (void)showErrorWithStatus:(NSString *)string duration:(NSTimeInterval)duration;

+ (void)setStatus:(NSString*)string; // change the HUD loading status while it‘s showing

+ (void)dismiss; // simply dismiss the HUD with a fade+scale out animation
+ (void)dismissWithSuccess:(NSString*)successString; // also displays the success icon image
+ (void)dismissWithSuccess:(NSString*)successString afterDelay:(NSTimeInterval)seconds;
+ (void)dismissWithError:(NSString*)errorString; // also displays the error icon image
+ (void)dismissWithError:(NSString*)errorString afterDelay:(NSTimeInterval)seconds;

+ (BOOL)isVisible;

时间: 2024-07-31 07:14:46

SVProgressHUD 用法一的相关文章

实现不同vlan间的相互通信方法一:单臂路由

实现不同vlan间的相互通信方法一:单臂路由   一.试验目的:通过单臂路由实现VLAN间的通信 二.使用工具:GNS3模拟器,SecureCRT,其中PC1和PC2用Route模拟 三.实验拓扑: 四.具体步骤 1.设置PC1的IP:192.168.1.1 /24 网关:192.168.1.254 最后通过show ip inter brief进行验证 2.设置PC2的IP:192.168.2.1 /24 网关:192.168.2.254 最后通过show ip inter brief进行验证

数据结构与算法一

题目一:求1!+2!+-..+n! 的和的后6位,(注意n的范围) #include <iostream> using namespace std; const int MAX = 1000000; int getResu(int n) { int sum=0; int temp= 1; for(int i=1; i <= n; i++) { temp *= i; temp %= MAX; sum += temp; sum %= MAX; } return sum ; } int mai

洛谷P2365 任务安排 [解法一]

题目描述 N个任务排成一个序列在一台机器上等待完成(顺序不得改变),这N个任务被分成若干批,每批包含相邻的若干任务.从时刻0开始,这些任务被分批加工,第i个任务单独完成所需的时间是Ti.在每批任务开始前,机器需要启动时间S,而完成这批任务所需的时间是各个任务需要时间的总和(同一批任务将在同一时刻完成).每个任务的费用是它的完成时刻乘以一个费用系数Fi.请确定一个分组方案,使得总费用最小. 例如:S=1:T={1,3,4,2,1}:F={3,2,3,3,4}.如果分组方案是{1,2}.{3}.{4

JS实现图片上传预览效果:方法一

<script type="text/javascript"> //处理file input加载的图片文件 $(document).ready(function(e) { //判断浏览器是否有FileReader接口 if(typeof FileReader =='undefined') { /*$("#images_show").css({'background':'none'}).html('亲,您的浏览器还不支持HTML5的FileReader接口

依据数据集 进行 树 的构造(treeview & dataset) 方法一

type PDepData=^DepData; DepData = record ID: Integer; DepID: string; DepName: string; end; procedure FreeTV(tv: TTreeview); var i: Integer; begin for i := 0 to tv.Items.Count - 1 do begin dispose(tv.Items[i].Data); end; tv.Items.Clear; end; procedure

Cocos2d-x 精灵碰撞检测(方法一)

声明函数碰撞检测函数,两个精灵和重写update bool isCollision( CCPoint p1,CCPoint p2,int w1,int h1,int w2,int h2 ); CCSprite *sp2; CCSprite *sp1; virtual void update(float delta); //重写触摸事件 virtual void registerWithTouchDispatcher(); virtual bool ccTouchBegan(CCTouch *pT

js 算法一

1 写一个函数,去掉a数组中和b数组中相同的元素. 思路一:让a数组中的元素和b数组中的元素逐个比较,若相同,则删除. 方法一: function array_diff(a, b){ for(var i = 0; i < a.length; i++){ for(var j = 0; j < b.length; j++){ if(a[i] == b[j]){ a.splice(a.indexOf(b[j]), 1); //删除 j = -1; //必须保证a中的每一个元素都从b的第一个元素开始遍

SVProgressHUD进度条蒙版

GitHub:https://github.com/samvermette/SVProgressHUDSVProgressHUD和MBProgressHUD效果差不多,不过不需要使用协议,同时也不需要声明实例.直接通过类方法进行调用即可: [SVProgressHUD method] 可以使用以下方法来显示状态: + (void)show; + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; + (void)showWithStat

SVProgressHUD 相关

readme 1 #import "ViewController.h" 2 #import "SVProgressHUD.h" 3 4 @interface ViewController () 5 - (IBAction)seitchClick:(UISwitch *)sender; 6 7 @end 8 9 @implementation ViewController 10 11 - (void)viewDidLoad { 12 [super viewDidLoa