RDSHudShower.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. dispatch_async(dispatch_get_main_queue(), ^{
  27. [JKToast showBottomWithText:msg];
  28. });
  29. }
  30. }
  31. + (void)showBottomToastDebug:(NSString *)msg{
  32. #ifdef DEBUG
  33. if (msg!=nil&&msg.length>0) {
  34. dispatch_async(dispatch_get_main_queue(), ^{
  35. [JKToast showBottomWithText:msg];
  36. });
  37. }
  38. #endif
  39. }
  40. + (void)dismissHUD {
  41. dispatch_async(dispatch_get_main_queue(), ^{
  42. if([SVProgressHUD isVisible]){
  43. [SVProgressHUD dismiss];
  44. }
  45. });
  46. }
  47. + (void)setupHUD {
  48. [SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
  49. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
  50. [SVProgressHUD setMaximumDismissTimeInterval:3];
  51. [SVProgressHUD setMinimumDismissTimeInterval:1.2];
  52. [SVProgressHUD setBackgroundColor:RDSLightGrayColor];
  53. }
  54. + (void)showToast:(NSString *)msg{
  55. [SVProgressHUD dismiss];
  56. //[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  57. //[SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
  58. [SVProgressHUD setImageViewSize:CGSizeMake(0, -1)];
  59. [SVProgressHUD showImage:[UIImage new] status:msg];
  60. [SVProgressHUD dismissWithDelay:1.2 completion:^{
  61. //[SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
  62. //[SVProgressHUD setImageViewSize:CGSizeMake(28, 28)];
  63. //[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
  64. }];
  65. }
  66. + (void)showWithStatus:(NSString *)status{
  67. [SVProgressHUD showWithStatus:status];
  68. }
  69. + (void)showWithStatus:(NSString *)status autoDismiss:(BOOL)dismiss {
  70. [SVProgressHUD showWithStatus:status];
  71. if (dismiss) {
  72. [SVProgressHUD dismissWithDelay:2.0f];
  73. }
  74. }
  75. + (void)showWithStatus:(NSString *)status dismissAffter:(NSTimeInterval)second {
  76. [SVProgressHUD showWithStatus:status];
  77. [SVProgressHUD dismissWithDelay:second];
  78. }
  79. + (void)showWithStatusDismissAffter:(NSTimeInterval)second{
  80. dispatch_async(dispatch_get_main_queue(), ^{
  81. [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
  82. [SVProgressHUD showWithStatus:nil];
  83. [SVProgressHUD dismissWithDelay:second];
  84. });
  85. }
  86. + (void)showInfoWithStatus:(NSString*)status {
  87. [SVProgressHUD showInfoWithStatus:status];
  88. }
  89. + (void)showSuccessWithStatus:(NSString *)status {
  90. [SVProgressHUD showSuccessWithStatus:status];
  91. }
  92. + (void)showErrorWithStatus:(NSString *)status {
  93. [SVProgressHUD showErrorWithStatus:status];
  94. }
  95. @end