027-Catagory-MBProgressHUD

#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ù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 香香姐福彩3d.精準(zhǔn)7碼 以上10期共中7期,還欠圓滿, 需繼續(xù)努力,爭取10中89 加油! 124期014568...
    香香姐駕到閱讀 11,052評論 13 25
  • 每天沒有任何任務(wù),這生活起來其實(shí)也還是很沒意思的。人就是賤的,得到了又發(fā)現(xiàn)不過是這樣而已。本來今天要去咨詢雙眼皮手...
    最喜不過淡雅閱讀 238評論 0 0
  • 得到APP 劉潤專欄文章總結(jié)筆記 -->TOP1概念: 看的見的手(政府):凱恩斯認(rèn)為,經(jīng)濟(jì)也得需要國家調(diào)控這只“...
    瑾蘭閱讀 1,443評論 0 2
  • 領(lǐng)會(huì)科斯定律的精神在現(xiàn)實(shí)生活的各種沖突當(dāng)中,積極的尋找合作解。 ——薛兆豐-北大經(jīng)濟(jì)學(xué)課
    鐘樹堂閱讀 161評論 0 0
  • 一壺潮州工夫茶的世界 是與火的對話 那炯炯燃燒的活火 似乎可以捕捉到那隨風(fēng)擺動(dòng)的火裙 ...
    瀟湘梨語閱讀 302評論 0 1

友情鏈接更多精彩內(nèi)容