GiGaMaskTime/GIGA/Common/GIGAMBHUDHelper/GIGAMBHUDHelper.m

92 lines
3.1 KiB
Objective-C

//
// GIGAMBHUDHelper.m
// GIGA
//
// Created by lianxiang on 2018/9/4.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GIGAMBHUDHelper.h"
@implementation GIGAMBHUDHelper
+ (void)networkError:(MBProgressHUD *)hud
{
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_error"]];
hud.labelText = GIGALocalComm(@"toast_hud_net_error");
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)networkError:(MBProgressHUD *)hud
title:(NSString *)aTitle
{
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_error"]];
hud.labelText = aTitle;
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)networkSucc:(MBProgressHUD *)hud
title:(NSString *)aTitle
{
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_ok"]];
hud.labelText = aTitle;
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)networkInfo:(MBProgressHUD *)hud
title:(NSString *)aTitle
{
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_info"]];
hud.labelText = aTitle;
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
/**
* Paramas is view, notic MBProgress message in view.
*/
+ (void)networkErrorAddto:(UIView *)aView
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:aView animated:YES];
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_error"]];
hud.labelText = GIGALocalComm(@"");
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)networkErrorAddto:(UIView *)aView
title:(NSString *)aTitle
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:aView animated:YES];
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_error"]];
hud.labelText = aTitle;
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)networkSuccAddto:(UIView *)aView
title:(NSString *)aTitle
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:aView animated:YES];
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_ok"]];
hud.labelText = aTitle;
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)networkInfoAddto:(UIView *)aView
title:(NSString *)aTitle
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:aView animated:YES];
hud.mode = MBProgressHUDModeCustomView;
hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hud_info"]];
hud.labelText = aTitle;
[hud hide:YES afterDelay:HUD_DISPLAY_DURATION];
}
+ (void)messageAddto:(UIView *)aView title:(NSString *)aTitle
{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:aView animated:YES];
hud.labelText = aTitle;
[hud hide:YES afterDelay:1.0f];
}
@end