123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // RDSHudShower.m
- // RuiYuRealEstate
- //
- // Created by coderYK on 2018/9/5.
- // Copyright © 2018年 coderYK. All rights reserved.
- //
- #import "RDSHudShower.h"
- #import "iToast.h"
- #import "JKToast.h"
- //#import <SVProgressHUD.h>
- @implementation RDSHudShower
- + (void)showCenterToast:(NSString *)msg {
- if (msg!=nil&&msg.length>0) {
- // iToast *toast =[iToast makeText:msg];
- // [toast show];
- [RDSHudShower dismissHUD];
- dispatch_async(dispatch_get_main_queue(), ^{
- [JKToast showCenterWithText:msg];
- });
-
- }
- }
- + (void)showBottomToast:(NSString *)msg {
- if (msg!=nil&&msg.length>0) {
- [RDSHudShower dismissHUD];
- [JKToast showBottomWithText:msg];
- }
- }
- + (void)showBottomToastDebug:(NSString *)msg{
-
- #ifdef DEBUG
- if (msg!=nil&&msg.length>0) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [JKToast showBottomWithText:msg];
- });
- }
- #endif
-
- }
- + (void)dismissHUD {
-
- dispatch_async(dispatch_get_main_queue(), ^{
- if([SVProgressHUD isVisible]){
- [SVProgressHUD dismiss];
- }
-
- });
-
- }
- + (void)setupHUD {
-
- [SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
- [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
- [SVProgressHUD setMaximumDismissTimeInterval:3];
- [SVProgressHUD setMinimumDismissTimeInterval:1.2];
- [SVProgressHUD setBackgroundColor:RDSLightGrayColor];
- }
- + (void)showToast:(NSString *)msg{
- [SVProgressHUD dismiss];
- //[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
- //[SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
- [SVProgressHUD setImageViewSize:CGSizeMake(0, -1)];
- [SVProgressHUD showImage:[UIImage new] status:msg];
- [SVProgressHUD dismissWithDelay:1.2 completion:^{
- //[SVProgressHUD setDefaultStyle:SVProgressHUDStyleLight];
- //[SVProgressHUD setImageViewSize:CGSizeMake(28, 28)];
- //[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
- }];
- }
- + (void)showWithStatus:(NSString *)status{
- [SVProgressHUD showWithStatus:status];
- }
- + (void)showWithStatus:(NSString *)status autoDismiss:(BOOL)dismiss {
-
- [SVProgressHUD showWithStatus:status];
- if (dismiss) {
- [SVProgressHUD dismissWithDelay:2.0f];
- }
- }
- + (void)showWithStatus:(NSString *)status dismissAffter:(NSTimeInterval)second {
-
- [SVProgressHUD showWithStatus:status];
- [SVProgressHUD dismissWithDelay:second];
- }
- + (void)showWithStatusDismissAffter:(NSTimeInterval)second{
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeClear];
- [SVProgressHUD showWithStatus:nil];
- [SVProgressHUD dismissWithDelay:second];
- });
-
-
- }
- + (void)showInfoWithStatus:(NSString*)status {
- [SVProgressHUD showInfoWithStatus:status];
- }
- + (void)showSuccessWithStatus:(NSString *)status {
- [SVProgressHUD showSuccessWithStatus:status];
- }
- + (void)showErrorWithStatus:(NSString *)status {
- [SVProgressHUD showErrorWithStatus:status];
- }
- @end
|