#import <MBProgressHUD/MBProgressHUD.h>
@interface MBProgressHUD (JFProgressHUD)
/**
MBProgressHUD提示信息,1秒后自動(dòng)隱藏
@param targetView 目標(biāo)View
@param message 提示信息
*/
+ (void)myi_promptHudWithShowHUDAddedTo:(UIView *)targetView message:(NSString *)message;
/**
加載view的HUD
@param targetView 目標(biāo)View
*/
+ (void)myi_loadHudAddTo:(UIView *)targetView;
/**
MBProgressHUD提示信息,1秒后自動(dòng)隱藏
@param targetView 目標(biāo)View
@param message 提示信息
@param complete 隱藏后回調(diào)方法
*/
+ (void)myi_promptHudWithShowHUDAddedTo:(UIView *)targetView message:(NSString *)message complete:(void (^)())complete;
@end
#import "MBProgressHUD+JFProgressHUD.h"
@implementation MBProgressHUD (JFProgressHUD)
/// MBProgressHUD提示信息,1秒后自動(dòng)隱藏
+ (void)myi_promptHudWithShowHUDAddedTo:(UIView *)targetView message:(NSString *)message {
MBProgressHUD *hud = [[MBProgressHUD alloc] init];
hud = [MBProgressHUD showHUDAddedTo:targetView animated:YES];
hud.mode = MBProgressHUDModeText;
hud.label.text = message;
// 隱藏時(shí)候從父控件中移除
hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:1.0];
}
+ (void)myi_loadHudAddTo:(UIView *)targetView {
MBProgressHUD *hud = [[MBProgressHUD alloc] init];
hud = [MBProgressHUD showHUDAddedTo:targetView animated:YES];
}
+ (void)myi_promptHudWithShowHUDAddedTo:(UIView *)targetView message:(NSString *)message complete:(void (^)())complete {
MBProgressHUD *hud = [[MBProgressHUD alloc] init];
hud = [MBProgressHUD showHUDAddedTo:targetView animated:YES];
hud.mode = MBProgressHUDModeText;
hud.label.text = message;
// 隱藏時(shí)候從父控件中移除
hud.removeFromSuperViewOnHide = YES;
[hud hideAnimated:YES afterDelay:1.0];
[NSThread sleepForTimeInterval:1.0];
complete();
}
@end
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。