//
//  MBProgressHUDFunc.m
//  MobilePortal
//
//  Created by xiejiangbo on 2019/4/2.
//  Copyright © 2019 yin chen. All rights reserved.
//

#import "MBProgressHUDFunc.h"
#import "MBProgressHUD.h"

@interface MBProgressHUDFunc ()

@end

@implementation MBProgressHUDFunc
+(instancetype)sharedInstance{
    static MBProgressHUDFunc *_sharedInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken,^{
        _sharedInstance = [[MBProgressHUDFunc alloc] init];
    });
    return _sharedInstance;
}
-(MBProgressHUD *)mHUD{
    AppDelegate * app = (AppDelegate*)[UIApplication sharedApplication].delegate;
    if (!_mHUD) {
        _mHUD = [[MBProgressHUD alloc] initWithWindow:app.window];
    }
    [app.window addSubview:_mHUD];
    return _mHUD;
}

-(void)showHintView
{
    dispatch_async(dispatch_get_main_queue(), ^{
        self.mHUD.labelText = @"加载中...";
        [self.mHUD show:YES];
    });
}

-(void)hidenHintView
{
    [self.mHUD hide:YES];
}
@end
