| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // MBProgressHUD+Add.m
- //
- // Created by mj on 13-4-18.
- // Copyright (c) 2013年 itcast. All rights reserved.
- //
- #import "MBProgressHUD+Add.h"
- @implementation MBProgressHUD (Add)
- + (void)show:(NSString *)text icon:(NSString *)icon view:(UIView *)view
- {
- if (view == nil) view = [UIApplication sharedApplication].keyWindow;
-
- MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
- hud.labelText = text;
- hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"MBProgressHUD.bundle/%@", icon]]];
- hud.mode = MBProgressHUDModeCustomView;
-
- hud.removeFromSuperViewOnHide = YES;
-
- [hud hide:YES afterDelay:0.7];
- }
- + (void)showError:(NSString *)error toView:(UIView *)view{
- [self show:error icon:@"error.png" view:view];
- }
- + (void)showSuccess:(NSString *)success toView:(UIView *)view
- {
- [self show:success icon:@"success.png" view:view];
- }
- + (MBProgressHUD *)showMessag:(NSString *)message toView:(UIView *)view {
- if (view == nil) view = [UIApplication sharedApplication].keyWindow;
- MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
- hud.labelText = message;
- hud.removeFromSuperViewOnHide = YES;
- hud.dimBackground = YES;
- return hud;
- }
- @end
|