From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 12 Jul 2018 13:44:34 +0800 Subject: [PATCH] bug修复和功能优化 --- screendisplay/screendisplay/Classes/Category/MBProgressHUD+LMJ.m | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 145 insertions(+), 0 deletions(-) diff --git a/screendisplay/screendisplay/Classes/Category/MBProgressHUD+LMJ.m b/screendisplay/screendisplay/Classes/Category/MBProgressHUD+LMJ.m new file mode 100755 index 0000000..63a858e --- /dev/null +++ b/screendisplay/screendisplay/Classes/Category/MBProgressHUD+LMJ.m @@ -0,0 +1,145 @@ +// +// MBProgressHUD+LMJ.m +// iOSProject +// +// Created by windshan on 2017/12/28. +// Copyright �� 2017��� windshan. All rights reserved. +// + +#import "MBProgressHUD+LMJ.h" + +@implementation MBProgressHUD (LMJ) +#pragma mark ������������������ ++ (void)showError:(NSString *)error ToView:(UIView *)view{ + [self showCustomIcon:@"MBHUD_Error" Title:error ToView:view]; +} + ++ (void)showSuccess:(NSString *)success ToView:(UIView *)view +{ + [self showCustomIcon:@"MBHUD_Success" Title:success ToView:view]; +} + ++ (void)showInfo:(NSString *)Info ToView:(UIView *)view +{ + [self showCustomIcon:@"MBHUD_Info" Title:Info ToView:view]; +} + ++ (void)showWarn:(NSString *)Warn ToView:(UIView *)view +{ + [self showCustomIcon:@"MBHUD_Warn" Title:Warn ToView:view]; +} + +#pragma mark ������������������ ++ (MBProgressHUD *)showMessage:(NSString *)message ToView:(UIView *)view { + if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; + // ������������������������������ + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; + hud.mode=MBProgressHUDModeText; + hud.label.text=message; + hud.label.font= [UIFont systemFontOfSize:15]; + // ��������������������������������� + hud.removeFromSuperViewOnHide = YES; + //������������������������ + +// hud.dimBackground = YES; + hud.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor; + return hud; +} + +//������������ ++(void)showLoadToView:(UIView *)view{ + [self showMessage:@"���������..." ToView:view]; +} + + +/** + * ���������View + */ ++ (MBProgressHUD *)showProgressToView:(UIView *)view Text:(NSString *)text{ + if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; + hud.label.text=text; + hud.label.font= [UIFont systemFontOfSize:15]; + // ������������������������ + hud.backgroundView.style = MBProgressHUDBackgroundStyleBlur; + + return hud; +} + + +//������������������������������ ++ (void)showAutoMessage:(NSString *)message{ + + [self showAutoMessage:message ToView:nil]; +} + + +//��������������������������� ++ (void)showAutoMessage:(NSString *)message ToView:(UIView *)view{ + [self showMessage:message ToView:view RemainTime:1 Model:MBProgressHUDModeText]; +} + +//������������������������������ ++(void)showIconMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time{ + [self showMessage:message ToView:view RemainTime:time Model:MBProgressHUDModeIndeterminate]; +} + +//������������������������������ ++(void)showMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time{ + [self showMessage:message ToView:view RemainTime:time Model:MBProgressHUDModeText]; +} + ++(void)showMessage:(NSString *)message ToView:(UIView *)view RemainTime:(CGFloat)time Model:(MBProgressHUDMode)model{ + + if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; + // ������������������������������ + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; + hud.label.text=message; + hud.label.font= [UIFont systemFontOfSize:15]; + //������ + hud.mode = model; + // ��������������������������������� + hud.removeFromSuperViewOnHide = YES; + // ������������������������ + hud.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor; + // ��������������������������������� + hud.removeFromSuperViewOnHide = YES; + // X������������������ + [hud hideAnimated:YES afterDelay:time]; + +} + ++ (void)showCustomIcon:(NSString *)iconName Title:(NSString *)title ToView:(UIView *)view +{ + if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; + // ������������������������������ + MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; + hud.label.text=title; + hud.label.font= [UIFont systemFontOfSize:15]; + // ������������ + hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:iconName]]; + + // ��������������� + hud.mode = MBProgressHUDModeCustomView; + + // ��������������������������������� + hud.removeFromSuperViewOnHide = YES; + + // ������������������������ + hud.backgroundView.style = MBProgressHUDBackgroundStyleSolidColor; + + // 3������������������ + [hud hideAnimated:YES afterDelay:1]; +} + ++ (void)hideHUDForView:(UIView *)view +{ + if (view == nil) view = (UIView*)[UIApplication sharedApplication].delegate.window; + [self hideHUDForView:view animated:YES]; +} + ++ (void)hideHUD +{ + [self hideHUDForView:nil]; +} +@end -- Gitblit v1.8.0