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;
本文禁止任何網站轉載,嚴厲譴責那些蛀蟲們。
本文首發於,博客園,請搜索:博客園 - 尋自己,查看原版文章
本文首發地址:http://www.cnblogs.com/xunziji/archive/2012/11/05/2754915.html - SVProgressHUD 用法
本文首發於,博客園,請搜索:博客園 - 尋自己,查看原版文章
本文首發地址:http://www.cnblogs.com/xunziji/archive/2012/11/05/2754915.html - SVProgressHUD 用法