// // UIView+Hint.m // HCQuanfangtong // // Created by qft_Ios_03 on 2018/4/24. // Copyright © 2018年 qft_Ios_03. All rights reserved. // #import "UIView+Hint.h" @implementation UIView (Hint) - (void)xb_showHudOfMessage:(NSString *)msg withAfterTime:(float)time{ MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self animated:YES]; hud.label.text = msg; [hud hideAnimated:YES afterDelay:time]; } - (void)xb_showHudOfErrorIconMessage:(NSString *)msg withAfterTime:(float)time{ if (msg.length==0) { return; } //显示提示信息 UIView *view = [[UIApplication sharedApplication].delegate window]; MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; // Configure for text only and offset down hud.mode = MBProgressHUDModeText; hud.bezelView.color=[UIColor blackColor]; hud.label.font=[UIFont systemFontOfSize:14]; hud.label.textColor=[UIColor whiteColor]; hud.label.text= msg; hud.label.numberOfLines=0; hud.margin = 10.f; hud.removeFromSuperViewOnHide = YES; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [hud hideAnimated:YES]; }); } - (void)xb_showHudOfSucceedIconMessage:(NSString *)msg withAfterTime:(float)time{ MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self animated:YES]; hud.mode = MBProgressHUDModeText; hud.bezelView.color=[UIColor blackColor]; hud.label.font=[UIFont systemFontOfSize:14]; hud.label.textColor=[UIColor whiteColor]; hud.label.text= msg; hud.label.numberOfLines=0; hud.margin = 10.f; hud.removeFromSuperViewOnHide = YES; // UIImageView *custom = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"succeed"]]; // hud.customView = custom; [hud hideAnimated:YES afterDelay:time]; } - (void)xb_showProgress{ [MBProgressHUD showHUDAddedTo:self animated:YES]; } - (void)xb_dismiss{ [MBProgressHUD hideHUDForView:self animated:YES]; } - (void)xb_showSheetWithMessage:(NSString *)msg withAfterTime:(float)time{ MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.window animated:YES]; hud.mode = MBProgressHUDModeText; hud.label.text = msg; hud.offset = CGPointMake(0.f, 1000000.f); [hud hideAnimated:YES afterDelay:3.f]; } @end