IOS third-party framework-mbprogresshud
Mbprogresshud Alert Box website address: Https://github.com/jdg/MBProgressHUD
The official website has provided enough examples for us to use, but in the implementation of development, we use only a small part of it. To make it easier to use, expand it below (Category)
Mbprogresshud+nj.h
#import "MBProgressHUD.h" @interface Mbprogresshud (NJ) + (void) showsuccess: (NSString *) success;+ (void) Showsuccess: ( NSString *) Success Toview: (UIView *) view;+ (void) ShowError: (NSString *) error;+ (void) ShowError: (NSString *) error Toview: (UIView *) view;+ (Mbprogresshud *) ShowMessage: (NSString *) message;+ (Mbprogresshud *) ShowMessage: (NSString *) Message Toview: (UIView *) view;+ (void) hidehud;+ (void) Hidehudforview: (UIView *) view; @end
Mbprogresshud+nj.m
#import "Mbprogresshud+nj.h" @implementation Mbprogresshud (NJ)/** * Display information * * @param text message content * @param icon * @para The view displayed by M view */+ (void) Show: (NSString *) Text icon: (NSString *) icon view: (UIView *) view{if (view = = nil) view = [[Uiapp Lication Sharedapplication].windows Lastobject]; Quick display a hint message mbprogresshud *hud = [Mbprogresshud showhudaddedto:view animated:yes]; Hud.labeltext = text; Set Picture Hud.customview = [[Uiimageview alloc] initwithimage:[uiimage imagenamed:[nsstring stringwithformat:@ "MBProgres shud.bundle/%@ ", Icon]]; Re-set Mode Hud.mode = Mbprogresshudmodecustomview; Remove hud.removefromsuperviewonhide = YES from the parent control when hidden; Disappears after 1 seconds [HUD Hide:yes afterdelay:0.7];} /** * Display Success Information * * @param success Information content */+ (void) showsuccess: (NSString *) success{[self showsuccess:success toview:nil] ;} /** * Display Success Information * * @param success Information content * @param view display information views */+ (void) showsuccess: (NSString *) Success Toview: (UIView *) view{[self SHOW:SUCCESS icon:@ "Success.png" View:view];} /** * Display Error message * */+ (void) ShowError: (NSString *) error{[self showerror:error toview:nil];} /** * Display Error message * * @param error message Contents * @param view needs to display information */+ (void) ShowError: (NSString *) error Toview: (UIView *) VI ew{[self show:error icon:@ "error.png" View:view];} /** * Display Error message * * @param message message content * * @return return directly to a mbprogresshud, need to manually close */+ (Mbprogresshud *) ShowMessage: (nsstring *) message{return [self showmessage:message toview:nil];} /** * Display some information * * @param message message content * @param view needs to display information of the views * * @return directly return a mbprogresshud, need to manually close */+ (mbprogress HUD *) ShowMessage: (NSString *) message Toview: (UIView *) View {if (view = nil) view = [[UIApplication sharedapplication ].windows Lastobject]; Quick display a hint message mbprogresshud *hud = [Mbprogresshud showhudaddedto:view animated:yes]; Hud.labeltext = message; Remove hud.removefromsuperviewonhide = YES from the parent control when hidden; Yes indicates a mask effect is required hud.dimbackground = yes; Return HUD;} /** * HandClose Mbprogresshud */+ (void) hidehud{[self hidehudforview:nil];} /** * Manual Off Mbprogresshud * * @param view display mbprogresshud views */+ (void) Hidehudforview: (UIView *) view{if (view = = Ni L) view = [[UIApplication sharedapplication].windows Lastobject]; [Self Hidehudforview:view animated:yes];} @end
IOS third-party framework-mbprogresshud