SVProgressHUD 是一個第三方的控件匆骗,是一個彈出提示層劳景,用來提示 網(wǎng)絡加載 或 提示對錯,看下面圖碉就,你就明白了:
那么盟广,SVProgressHUD?都有什么特點呢:
1. 提示當前的狀態(tài),如:網(wǎng)絡傳輸瓮钥、提交中筋量、操作成功或失敗等等.
2. 可是設置提示的 pop layer 是否為 model,就是碉熄,提示的時間是否允許用戶做其他操作
3. 可以設置 背景色 和 自定義提示的內(nèi)容
4. 使用起來非常簡潔桨武,代碼量非常少
那么如何使用?SVProgressHUD 呢:
1.官網(wǎng)下載代碼,并放入到項目中
2. 在使用到的 項目 里面锈津,加入引用 ?#import "SVProgressHUD.h"
3. 在需要提示的地方呀酸,加入調(diào)用代碼 ,如:
[SVProgressHUD showWithStatus:@"加載中..." maskType:SVProgressHUDMaskTypeGradient]
4. 在需要隱藏的地方琼梆,加入隱藏當前提示的代碼性誉,如:[SVProgressHUD dismiss]
SVProgressHUD?常用方法介紹:
1.?+ (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType?調(diào)用?SVProgressHUD,并自定義 提示的內(nèi)容 和 提示層的樣式
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 *)stringduration:(NSTimeInterval)duration;
+ (void)showErrorWithStatus:(NSString *)string;
+ (void)showErrorWithStatus:(NSString *)stringduration:(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;
SVProgressHUD
又一款輕量級的 iOS 第三方控件, 用于顯示任務加載時的動畫, 非常輕便, 容易使用.
這個更加輕量級了倾哺,拖入工程就好
//感嘆號
[SVProgressHUD showInfoWithStatus:@"xxxxx."];
//success
[SVProgressHUD showSuccessWithStatus:@"Success!"];
//error
[SVProgressHUD showErrorWithStatus:@"Error"];
個人一般就用這三個,配合大量數(shù)據(jù)請求的話還是用 MB携冤,個人看法悼粮。