RDSHudShower.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. // RDSHudShower.m
  3. // RuiYuRealEstate
  4. //
  5. // Created by coderYK on 2018/9/5.
  6. // Copyright © 2018年 coderYK. All rights reserved.
  7. //
  8. #import "RDSHudShower.h"
  9. #import "iToast.h"
  10. #import "JKToast.h"
  11. //#import <SVProgressHUD.h>
  12. @implementation RDSHudShower
  13. + (void)showCenterToast:(NSString *)msg {
  14. if (msg!=nil&&msg.length>0) {
  15. // iToast *toast =[iToast makeText:msg];
  16. // [toast show];
  17. [RDSHudShower dismissHUD];
  18. dispatch_async(dispatch_get_main_queue(), ^{
  19. [JKToast showCenterWithText:msg];
  20. });
  21. }
  22. }
  23. + (void)showBottomToast:(NSString *)msg {
  24. if (msg!=nil&&msg.length>0) {
  25. [RDSHudShower dismissHUD];
  26. [JKToast showBottomWithText:msg];
  27. }
  28. }
  29. + (void)showBottomToastDebug:(NSString *)msg{
  30. #ifdef DEBUG
  31. if (msg!=nil&&msg.length>0) {
  32. dispatch_async(dispatch_get_main_queue(), ^{
  33. [JKToast showBottomWithText:msg];
  34. });
  35. }
  36. #endif
  37. }
  38. + (void)dismissHUD {
  39. dispatch_async(dispatch_get_main_queue(), ^{
  40. if([SVProgressHUD isVisible]){
  41. [SVProgressHUD dismiss];
  42. }
  43. });
  44. }
  45. + (void)setupHUD {
  46. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
  47. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
  48. [SVProgressHUD setMaximumDismissTimeInterval:3];
  49. [SVProgressHUD setMinimumDismissTimeInterval:1.2];
  50. [SVProgressHUD setBackgroundColor:RDSLightGrayColor];
  51. }
  52. + (void)showToast:(NSString *)msg{
  53. [SVProgressHUD dismiss];
  54. //[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  55. //[SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
  56. [SVProgressHUD setImageViewSize:CGSizeMake(0, -1)];
  57. [SVProgressHUD showImage:[UIImage new] status:msg];
  58. [SVProgressHUD dismissWithDelay:1.2 completion:^{
  59. //[SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
  60. //[SVProgressHUD setImageViewSize:CGSizeMake(28, 28)];
  61. //[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
  62. }];
  63. }
  64. + (void)showWithStatus:(NSString *)status{
  65. [SVProgressHUD showWithStatus:status];
  66. }
  67. + (void)showWithStatus:(NSString *)status autoDismiss:(BOOL)dismiss {
  68. [SVProgressHUD showWithStatus:status];
  69. if (dismiss) {
  70. [SVProgressHUD dismissWithDelay:2.0f];
  71. }
  72. }
  73. + (void)showWithStatus:(NSString *)status dismissAffter:(NSTimeInterval)second {
  74. [SVProgressHUD showWithStatus:status];
  75. [SVProgressHUD dismissWithDelay:second];
  76. }
  77. + (void)showWithStatusDismissAffter:(NSTimeInterval)second{
  78. dispatch_async(dispatch_get_main_queue(), ^{
  79. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  80. [SVProgressHUD showWithStatus:nil];
  81. [SVProgressHUD dismissWithDelay:second];
  82. });
  83. }
  84. + (void)showInfoWithStatus:(NSString*)status {
  85. [SVProgressHUD showInfoWithStatus:status];
  86. }
  87. + (void)showSuccessWithStatus:(NSString *)status {
  88. [SVProgressHUD showSuccessWithStatus:status];
  89. }
  90. + (void)showErrorWithStatus:(NSString *)status {
  91. [SVProgressHUD showErrorWithStatus:status];
  92. }
  93. @end