本文共 23932 字,大约阅读时间需要 79 分钟。
=============封装一:#import#import typedef void (^ AfterHudDisappearBlock) (void);@interface AXProgressHUDHelper : NSObject@property (nonatomic,assign) CGFloat autoHideTime;+ (AXProgressHUDHelper*)getInstance;// 在window上显示hud// 参数:// caption:标题// bActive:是否显示转圈动画// time:自动消失时间,如果为0,则不自动消失- (void)showHudOnWindow:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time;// 在当前的view上显示hud// 参数:// view:要添加hud的view// caption:标题// image:图片// bActive:是否显示转圈动画// time:自动消失时间,如果为0,则不自动消失- (void)showHudOnView:(UIView *)view caption:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time;//有loading 状态- (void)showWithStatus:(NSString *) status onView:(UIView *)view;- (void)dismissOnView:(UIView *)view;//有感叹号提示- (void)showInfoWithStatus:(NSString*)status onView:(UIView *)view;- (void)showWithStatusOnWindow:(NSString *)caption;- (void)showInfoWithStatus:(NSString*)status onView:(UIView *)view autoHideTime:(NSTimeInterval)time;- (void)showInfoOnWindowWithStatus:(NSString*)status;- (void)showHudOnView:(UIView *)view caption:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time animated:(BOOL)animated;- (void)showAutoTimeHudOnWindow:(NSString *)caption;- (void)showAutoTimeHudOnView:(UIView *)view caption:(NSString *)caption;- (void)showHudOnView:(UIView *)view caption:(NSString *)caption autoHideTime:(NSTimeInterval)time;- (void)showHudOnWindow:(NSString *)caption autoHideTime:(NSTimeInterval)autoHideTimeInterval;- (void)showHudOnView:(UIView *)view caption:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time doBlock:(AfterHudDisappearBlock)block;// 隐藏hud- (void)hideHudInView:(UIView *)parentView;- (void)hideHudInView:(UIView *)parentView after:(NSTimeInterval)time;- (void)hideHudInWindow;/** oading状态*/- (void)showThemeLoadingOnView:(UIView *)view;/** 屏蔽用户交互行为,带对勾的文案*/- (void)showSuccessWithStatus:(NSString *) statue onView:(UIView *)view;/** 不屏蔽用户交互行为,带对勾的文案*/- (void)showInteractiveSuccessWithStatus:(NSString *) status onView:(UIView *)view;/** 屏蔽用户交互行为,带叉子的文案*/- (void)showErrorWithStatus:(NSString*)status onView:(UIView *)view;/** 不屏蔽用户交互行为,带叉子的文案*/- (void)showInteractiveErrorWithStatus:(NSString*)status onView:(UIView *)view;/** 展示文字和自定义图片,如果无法获取当前view,传nil也可获得当前最上层的view*/- (void)showImageTextWithStatus:(NSString *)statusStr image:(UIImage *)image onView:(UIView *)view;/** 展示文字,如果无法获取当前view,传nil也可获得当前最上层的view*/- (void)showTextWithStatus:(NSString *)statusStr onView:(UIView *)view;@end===========================#import "AXProgressHUDHelper.h"#import "MBProgressHUD.h"@interface AXProgressHUDHelper ()@property (nonatomic,strong) NSString *showingCaption;@property (nonatomic,strong) MBProgressHUD *hud;@property (nonatomic,strong) UIView *parentView;@end@implementation AXProgressHUDHelperstatic AXProgressHUDHelper* hudInstance = nil;- (id)init{ self = [super init]; if (self) { self.autoHideTime = 1.5; } return self;}#pragma mark - public method+ (AXProgressHUDHelper*) getInstance{ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ hudInstance = [[AXProgressHUDHelper alloc] init]; }); return hudInstance;}// 在window上显示hud- (void)showHudOnWindow:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time{ UIView *v = [[UIApplication sharedApplication].delegate window]; [self showHudOnView:v caption:caption image:image acitivity:bAcitve autoHideTime:time];}// 在当前的view上显示hud- (void)showHudOnView:(UIView *)view caption:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time{ if (!view) { view = [self getTopController].view; } [self showHudOnView:view caption:caption image:image acitivity:bAcitve autoHideTime:time animated:YES];}// 在当前的view上显示hud,带动画选项- (void)showHudOnView:(UIView *)view caption:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time animated:(BOOL)animated{ // 删除此view上原有的hud NSArray *array; if (view) { array = [MBProgressHUD allHUDsForView:view]; } else { view = [self getTopController].view; array = [MBProgressHUD allHUDsForView:[self getTopController].view]; } for (MBProgressHUD *obj in array) { [obj hide:NO]; } MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:animated]; hud.detailsLabelText = caption; if (!bAcitve) { hud.mode = MBProgressHUDModeText; } else { hud.mode = MBProgressHUDModeIndeterminate; } if (image != nil) { hud.mode = MBProgressHUDModeCustomView; hud.customView = [[UIImageView alloc] initWithImage:image]; } if (time > 0.0f) { [hud hide:YES afterDelay:time]; } [hud layoutSubviews];}- (void)showHudOnView:(UIView *)view caption:(NSString *)caption image:(UIImage *)image acitivity:(BOOL)bAcitve autoHideTime:(NSTimeInterval)time doBlock:(AfterHudDisappearBlock)block{ // 删除此view上原有的hud NSArray *array; if (view) { array = [MBProgressHUD allHUDsForView:view]; } else { view = [self getTopController].view; array = [MBProgressHUD allHUDsForView:[self getTopController].view]; } for (MBProgressHUD *obj in array) { [obj hide:NO]; } MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; hud.detailsLabelText = caption; hud.completionBlock = block; if (!bAcitve) { hud.mode = MBProgressHUDModeText; } else { hud.mode = MBProgressHUDModeIndeterminate; } if (image != nil) { hud.mode = MBProgressHUDModeCustomView; hud.customView = [[UIImageView alloc] initWithImage:image]; } if (time > 0.0f) { [hud hide:YES afterDelay:time]; } [hud layoutSubviews];}- (void)showAutoTimeHudOnWindow:(NSString *)caption { [self showHudOnWindow:caption autoHideTime:self.autoHideTime];}- (void)showAutoTimeHudOnView:(UIView *)view caption:(NSString *)caption{ if (!view) { view = [self getTopController].view; } [self showHudOnView:view caption:caption image:nil acitivity:NO autoHideTime:self.autoHideTime];}- (void)showHudOnView:(UIView *)view caption:(NSString *)caption autoHideTime:(NSTimeInterval)autoHideTimeInterval{ if (!view) { view = [self getTopController].view; } [self showHudOnView:view caption:caption image:nil acitivity:NO autoHideTime:autoHideTimeInterval];}- (void)showHudOnWindow:(NSString *)caption autoHideTime:(NSTimeInterval)autoHideTimeInterval{ UIView *v = [[UIApplication sharedApplication].delegate window]; [self showHudOnView:v caption:caption image:nil acitivity:NO autoHideTime:autoHideTimeInterval];}// 隐藏hud- (void)hideHudInView:(UIView *)parentView{ if (!parentView) { parentView = [self getTopController].view; } [MBProgressHUD hideAllHUDsForView:parentView animated:YES];}- (void)hideHudInView:(UIView *)parentView after:(NSTimeInterval)time{ NSArray *array; if (parentView) { } else { parentView = [self getTopController].view; } array = [MBProgressHUD allHUDsForView:parentView]; for (MBProgressHUD *hud in array) { hud.removeFromSuperViewOnHide = YES; [hud hide:YES afterDelay:time]; }}- (void)hideHudInWindow{ UIView *v = [UIApplication sharedApplication].keyWindow; [self hideHudInView:v];}#pragma mark 封装- (void)showWithStatus:(NSString *) status onView:(UIView *)view{ if (view) { [self showHudOnView:view caption: status image:nil acitivity:true autoHideTime: 0]; } else { [self showHudOnView:[self getTopController].view caption: status image:nil acitivity:true autoHideTime: 0]; }}- (void)showThemeLoadingOnView:(UIView *)view { if (view) { [self showHudOnView:view caption:@"正在加载" image:nil acitivity:true autoHideTime: 0]; } else { [self showHudOnView:[self getTopController].view caption:@"正在加载" image:nil acitivity:true autoHideTime: 0]; }}- (void)showWithStatusOnWindow:(NSString *)status{ UIWindow *window = [UIApplication sharedApplication].keyWindow; [self showHudOnView: window caption: status image:nil acitivity:true autoHideTime: 0];}- (void)dismissOnView:(UIView *)view{ if (!view) { view = [self getTopController].view; } [self hideHudInView:view];}- (void)showWithStatus:(NSString *)status image:(UIImage *)image interactive:(BOOL)interactive onView:(UIView *)view{ // 删除此view上原有的hud NSArray *array; if (view) { array = [MBProgressHUD allHUDsForView:view]; } else { view = [self getTopController].view; array = [MBProgressHUD allHUDsForView:[self getTopController].view]; } for (MBProgressHUD *obj in array) { [obj hide:NO]; } MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; hud.userInteractionEnabled = !interactive; hud.detailsLabelText = status; hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeCustomView; [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; UIImageView *imageView1 = [[UIImageView alloc] initWithImage:image]; imageView1.tintColor = [UIColor whiteColor]; hud.customView = imageView1; NSTimeInterval time = [self displayDurationForString:status]; if ([self displayDurationForString:status] < 2.0) { time = 2.0f; } [hud hide:YES afterDelay:time]; [hud layoutSubviews];}//不可交互成功框- (void)showSuccessWithStatus:(NSString *) status onView:(UIView *)view { UIImage *image = [UIImage imageNamed:@"success.png"]; [self showWithStatus:status image:image interactive:NO onView:view];}//不可交互失败框- (void)showErrorWithStatus:(NSString*)status onView:(UIView *)view { UIImage *image = [UIImage imageNamed:@"error.png"]; [self showWithStatus:status image:image interactive:NO onView:view];}//可交互成功框- (void)showInteractiveSuccessWithStatus:(NSString *)status onView:(UIView *)view { UIImage *image = [UIImage imageNamed:@"success.png"]; [self showWithStatus:status image:image interactive:YES onView:view];}//可交互失败框- (void)showInteractiveErrorWithStatus:(NSString*)status onView:(UIView *)view { UIImage *image = [UIImage imageNamed:@"error.png"]; [self showWithStatus:status image:image interactive:YES onView:view];}//展示文字和图片- (void)showImageTextWithStatus:(NSString *)statusStr image:(UIImage *)image onView:(UIView *)view { [self showWithStatus:statusStr image:image interactive:YES onView:view];}//直接展示文字- (void)showTextWithStatus:(NSString *)statusStr onView:(UIView *)view { [self showWithStatus:statusStr image:nil interactive:YES onView:view];}- (void)showInfoWithStatus:(NSString*)status onView:(UIView *)view{ [self showInfoWithStatus:status onView:view autoHideTime:[self displayDurationForString:status]];}- (void)showInfoWithStatus:(NSString*)status onView:(UIView *)view autoHideTime:(NSTimeInterval)time{ // 删除此view上原有的hud NSArray *array; if (view) { array = [MBProgressHUD allHUDsForView:view]; } else { view = [self getTopController].view; array = [MBProgressHUD allHUDsForView:[self getTopController].view]; } for (MBProgressHUD *obj in array) { [obj hide:NO]; } MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES]; hud.detailsLabelText = status; hud.mode = MBProgressHUDModeText; hud.mode = MBProgressHUDModeCustomView; UIImage *successImage = [UIImage imageNamed:@"info.png"]; successImage = [successImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; hud.customView = [[UIImageView alloc] initWithImage:successImage]; [hud.customView setTintColor:[UIColor whiteColor]]; [hud hide:YES afterDelay:time]; [hud layoutSubviews];}- (void)showInfoOnWindowWithStatus:(NSString*)status{ UIWindow *window = [UIApplication sharedApplication].keyWindow; [self showHudOnView: window caption: status image:nil acitivity:NO autoHideTime: 4.5];}- (NSTimeInterval)displayDurationForString:(NSString*)string{ return MIN((float)string.length * 0.06 + 0.5, 5.0);}- (UIViewController *)getTopController { UIViewController *blockViewController = [UIApplication sharedApplication].keyWindow.rootViewController; while (blockViewController.presentedViewController) { blockViewController = blockViewController.presentedViewController; } if ([blockViewController respondsToSelector:@selector(selectedViewController)]) { blockViewController = [blockViewController performSelector:@selector(selectedViewController)]; } if ([blockViewController isKindOfClass:[UINavigationController class]]) { blockViewController = [(UINavigationController *)blockViewController topViewController]; } return blockViewController;}@end
++++++++++++++++++++++封装二
#import#import "UIView+QMWNFrame.h"NS_ASSUME_NONNULL_BEGIN@interface LYCommonMBprogresshud : NSObject+(instancetype)sharedManager;//取消带动画的提示-(void)dimisAnimalProgressWith:(UIView *)view;//指示器动画无背景带标题-(void)showProgresshudAnimalnobgWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay;//有动画文字标题-(void)showProgresshudAnimalWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay;//无动画标题-(void)showProgresshudTextWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay;//无动画有标题二sec-(void)secshowProgresshudTextWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay;//无动画自定义View-(void)showProgresshudTextWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay isCustomView:(BOOL)isCustomView;//自定义简易版本-(void)autodeifeinesimpleTipWithTItle:(NSString *)title view:(UIView *)v;@endNS_ASSUME_NONNULL_END#import "LYCommonMBprogresshud.h"#import "MBProgressHUD.h"#import "UIColor+HexColor.h"@interface LYCommonMBprogresshud()@property(nonatomic,weak)MBProgressHUD *hud;@end@implementation LYCommonMBprogresshud+(instancetype)sharedManager{ static LYCommonMBprogresshud *lycommandmbprogresshud; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ lycommandmbprogresshud =[[LYCommonMBprogresshud alloc]init]; }); return lycommandmbprogresshud;}//取消带转圈的动画-(void)dimisAnimalProgressWith:(UIView *)view{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [MBProgressHUD hideHUDForView:[UIApplication sharedApplication].keyWindow animated:YES]; });}//指示器动画无背景带标题-(void)showProgresshudAnimalnobgWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay{ if(view){ if(!self.hud){ MBProgressHUD * hud=[[MBProgressHUD alloc]initWithView:[UIApplication sharedApplication].keyWindow]; self.hud=hud; [[UIApplication sharedApplication].keyWindow addSubview:hud]; } self.hud.mode=MBProgressHUDModeIndeterminate; self.hud.detailsLabel.font = [UIFont systemFontOfSize:13]; self.hud.label.textColor=[UIColor grayColor]; //修改样式,否则等待框背景色将为半透明 self.hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor; //设置等待框背景色为黑色 self.hud.bezelView.backgroundColor = [UIColor clearColor]; //设置菊花框为白色 self.hud.contentColor=[UIColor whiteColor]; self.hud.removeFromSuperViewOnHide = YES; self.hud.minSize=CGSizeMake(50,50); self.hud.animationType=MBProgressHUDAnimationZoomIn; if(title && ![title isEqualToString:@""]){ self.hud.label.text=title; } if(detailTitle && ![detailTitle isEqualToString:@""]){ self.hud.detailsLabel.text=detailTitle; } if(ison){ self.hud.backgroundView.color=[UIColor colorWithWhite:0.f alpha:.2f]; }else { self.hud.backgroundView.color=[UIColor clearColor]; } [self.hud showAnimated:YES]; if(hideAfterdelay){ [self.hud hideAnimated:YES afterDelay:2]; } } }//带动画带标题-(void)showProgresshudAnimalWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay{ if(view){ if(!self.hud){ MBProgressHUD * hud=[[MBProgressHUD alloc]initWithView:[UIApplication sharedApplication].keyWindow]; self.hud=hud; [[UIApplication sharedApplication].keyWindow addSubview:hud]; } self.hud.mode=MBProgressHUDModeIndeterminate; self.hud.detailsLabel.font = [UIFont systemFontOfSize:13]; self.hud.label.textColor=[UIColor grayColor]; self.hud.bezelView.color=[UIColor colorWithWhite:0.8 alpha:0.3]; self.hud.minSize=CGSizeMake(50,50); self.hud.animationType=MBProgressHUDAnimationZoomIn; if(title && ![title isEqualToString:@""]){ self.hud.label.text=title; } if(detailTitle && ![detailTitle isEqualToString:@""]){ self.hud.detailsLabel.text=detailTitle; } if(ison){ self.hud.backgroundView.color=[UIColor colorWithWhite:0.f alpha:.2f]; }else { self.hud.backgroundView.color=[UIColor clearColor]; } [self.hud showAnimated:YES]; if(hideAfterdelay){ [self.hud hideAnimated:YES afterDelay:2]; } } }//无动画有标题-(void)showProgresshudTextWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay{ if(view){ if(!self.hud){ MBProgressHUD * hud=[[MBProgressHUD alloc]initWithView:[UIApplication sharedApplication].keyWindow]; self.hud=hud; [[UIApplication sharedApplication].keyWindow addSubview:hud]; } self.hud.mode=MBProgressHUDModeText; self.hud.label.font=[UIFont systemFontOfSize:13]; self.hud.detailsLabel.font = [UIFont systemFontOfSize:15]; self.hud.label.textColor=[UIColor blackColor]; self.hud.label.adjustsFontSizeToFitWidth=YES; self.hud.bezelView.color=[UIColor colorWithWhite:0.9 alpha:1]; self.hud.minSize=CGSizeMake(200,50); self.hud.animationType=MBProgressHUDAnimationZoomIn; if(title && ![title isEqualToString:@""]){ self.hud.label.text=title; } if(detailTitle && ![detailTitle isEqualToString:@""]){ self.hud.detailsLabel.text=detailTitle; } if(ison){ self.hud.backgroundView.color=[UIColor colorWithWhite:0.f alpha:.2f]; }else { self.hud.backgroundView.color=[UIColor clearColor]; } [self.hud showAnimated:YES]; if(hideAfterdelay){ [self.hud hideAnimated:YES afterDelay:2]; } } }//无动画有标题二sec-(void)secshowProgresshudTextWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay{ if(view){ if(!self.hud){ MBProgressHUD * hud=[[MBProgressHUD alloc]initWithView:[UIApplication sharedApplication].keyWindow]; self.hud=hud; [[UIApplication sharedApplication].keyWindow addSubview:hud]; } self.hud.mode=MBProgressHUDModeText; self.hud.label.font=[UIFont systemFontOfSize:13]; self.hud.detailsLabel.font = [UIFont systemFontOfSize:15]; self.hud.label.textColor=[UIColor blackColor]; self.hud.label.adjustsFontSizeToFitWidth=YES; self.hud.bezelView.color=[UIColor colorWithWhite:1 alpha:1]; self.hud.minSize=CGSizeMake(200,50); self.hud.animationType=MBProgressHUDAnimationZoomIn; if(title && ![title isEqualToString:@""]){ self.hud.label.text=title; } if(detailTitle && ![detailTitle isEqualToString:@""]){ self.hud.detailsLabel.text=detailTitle; } if(ison){ self.hud.backgroundView.color=[UIColor colorWithWhite:0.f alpha:.2f]; }else { self.hud.backgroundView.color=[UIColor clearColor]; } [self.hud showAnimated:YES]; if(hideAfterdelay){ [self.hud hideAnimated:YES afterDelay:2]; } } }//无动画自定义View-(void)showProgresshudTextWith:(UIView *)view title:(NSString *)title detailtitle:(NSString *)detailTitle isOnDismissbg:(BOOL)ison hideAfterdelay:(BOOL)hideAfterdelay isCustomView:(BOOL)isCustomView{ if(view){ if(!self.hud){ MBProgressHUD * hud=[[MBProgressHUD alloc]initWithView:[UIApplication sharedApplication].keyWindow]; self.hud=hud; [[UIApplication sharedApplication].keyWindow addSubview:hud]; } self.hud.mode=MBProgressHUDModeCustomView; UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake(0,0,200,20)]; lbl.font=[UIFont systemFontOfSize:15]; lbl.textColor=[UIColor grayColor]; lbl.backgroundColor=[UIColor whiteColor]; lbl.textAlignment=NSTextAlignmentCenter; lbl.numberOfLines=0; self.hud.bezelView.color=[UIColor whiteColor]; self.hud.bezelView.layer.borderColor=[UIColor colorWithRed:249.0/255 green:191.0/255 blue:71.0/255 alpha:1].CGColor;//24919171 self.hud.bezelView.layer.borderWidth=3; self.hud.bezelView.clipsToBounds=YES; self.hud.bezelView.bounds=CGRectMake(0, 0, 200, 20); self.hud.minSize=CGSizeMake(100, 20); self.hud.offset=CGPointMake(0, -65); self.hud.customView=lbl; self.hud.animationType=MBProgressHUDAnimationZoomIn; if(title && ![title isEqualToString:@""]){ lbl.text=title; } if(ison){ self.hud.backgroundView.color=[UIColor colorWithWhite:0.f alpha:.2f]; }else { self.hud.backgroundView.color=[UIColor clearColor]; } [self.hud showAnimated:YES]; if(hideAfterdelay){ [self.hud hideAnimated:YES afterDelay:2]; } }}//自定义简介提示-(void)autodeifeinesimpleTipWithTItle:(NSString *)title view:(UIView *)v{ UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake((WIDTH-120)/2,HEIGHT/2-80,120,40)]; lbl.font=[UIFont systemFontOfSize:15]; lbl.textColor=[UIColor grayColor]; lbl.backgroundColor=[UIColor whiteColor]; lbl.textAlignment=NSTextAlignmentCenter; lbl.numberOfLines=0; lbl.text=title; // lbl.layer.borderColor=[UIColor colorWithRed:249.0/255 green:191.0/255 blue:71.0/255 alpha:1].CGColor;//24919171 lbl.layer.borderColor=[UIColor wh_colorWithHexString:@"#E0D374" alpha:1].CGColor; lbl.layer.borderWidth=3; lbl.layer.cornerRadius=10; lbl.clipsToBounds=YES; [v addSubview:lbl]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [lbl removeFromSuperview]; });}@end
转载地址:http://lcmgi.baihongyu.com/