+ (void)showHudTipStr:(NSString *)tipStr; + (void)showHudTipStr:(NSString *)tipStr{ if (tipStr && tipStr.length > 0) { MBProgressHUD *hud = [self showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES]; hud.mode = MBProgressHUDModeText; hud.detailsLabelFont = [UIFont boldSystemFontOfSize:15.0]; hud.detailsLabelText = tipStr; hud.margin = 10.f; hud.removeFromSuperViewOnHide = YES; [hud hide:YES afterDelay:1.0]; } }
调用
[self.user updateInBackgroundWithResultBlock:^(BOOL isSuccessful, NSError *error) { NSString *tip = isSuccessful?@"设置成功":error.userInfo[@"error"]; [MBProgressHUD showHudTipStr:tip]; }];