ZCHUDHelper.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // TLSHUDHelper.m
  3. // tls
  4. //
  5. // Created by pican zhang on 2016/12/15.
  6. // Copyright © 2016年 tianlishe. All rights reserved.
  7. //
  8. #import "ZCHUDHelper.h"
  9. @implementation ZCHUDHelper
  10. + (void)showImage:(UIImage*)image title:(NSString*)title showtime:(CGFloat)showtime{
  11. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  12. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
  13. [SVProgressHUD setBackgroundColor:DecColorFromRGBA(0, 0, 0, 0.8)];
  14. [SVProgressHUD setForegroundColor:HexColorFromRGB(0xffb64b)];
  15. [SVProgressHUD setFont:[UIFont boldSystemFontOfSize:18]];
  16. [SVProgressHUD setCornerRadius:4.0];
  17. [SVProgressHUD setMinimumSize:CGSizeMake(1, 1)];
  18. [SVProgressHUD setSuccessImage:image];
  19. [SVProgressHUD showSuccessWithStatus:[NSString stringWithFormat:@"%@",title]];
  20. if (showtime !=0) {
  21. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(showtime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  22. [SVProgressHUD dismiss];
  23. });
  24. }
  25. }
  26. + (void)showTitle:(NSString*)title{
  27. [self showTitle:title showtime:3.0];
  28. }
  29. + (void)showTitle:(NSString*)title showtime:(CGFloat)showtime{
  30. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  31. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
  32. [SVProgressHUD setBackgroundColor:DecColorFromRGBA(0, 0, 0, 0.7)];
  33. [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
  34. [SVProgressHUD setFont:[UIFont boldSystemFontOfSize:14]];
  35. [SVProgressHUD setCornerRadius:4.0];
  36. [SVProgressHUD setMinimumSize:CGSizeMake(1, 1)];
  37. [SVProgressHUD setSuccessImage:nil];
  38. [SVProgressHUD showSuccessWithStatus:[NSString stringWithFormat:@"%@",title]];
  39. if (showtime !=0) {
  40. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(showtime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  41. [SVProgressHUD dismiss];
  42. });
  43. }
  44. }
  45. + (void)show{
  46. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  47. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  48. [SVProgressHUD setBackgroundColor:DecColorFromRGBA(0, 0, 0, 0.7)];
  49. [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
  50. [SVProgressHUD show];
  51. }
  52. + (void)showWithStatus:(NSString*)status{
  53. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleCustom];
  54. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  55. [SVProgressHUD setBackgroundColor:DecColorFromRGBA(0, 0, 0, 0.7)];
  56. [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
  57. [SVProgressHUD showWithStatus:status];
  58. }
  59. + (void)dismiss{
  60. [SVProgressHUD dismiss];
  61. }
  62. @end