Explorar o código

loading 统一

Steven hai 9 meses
pai
achega
34c09e9c75

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/xcshareddata/xcschemes/KulexiuForTeacher.xcscheme

@@ -52,7 +52,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "DEV"
+      buildConfiguration = "TEST"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 1 - 12
KulexiuForTeacher/KulexiuForTeacher/Common/Base/BaseViewContolller/KSBaseViewController.m

@@ -20,9 +20,6 @@
 #define PROMPT_TIME  1.5f
 
 @interface KSBaseViewController ()
-{
-    MBProgressHUD *t_MBProgressHUD;
-}
 
 @property (nonatomic, strong) UIView *promptPlaceView;
 @end
@@ -300,15 +297,7 @@
     }
     
     if (!isExistenceNetwork) {
-        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
-        hud.removeFromSuperViewOnHide =YES;
-        hud.mode = MBProgressHUDModeText;
-        hud.label.text = NSLocalizedString(@"当前没有网络,请先连接网络", nil);
-        hud.minSize = CGSizeMake(132.f, 108.0f);
-        hud.label.textColor = [UIColor whiteColor];
-        hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-        hud.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
-        [hud hideAnimated:YES afterDelay:5];
+        [LOADING_MANAGER MBPShow:@"当前没有网络,请先连接网络" inView:self.view];
         return NO;
     }
     

+ 7 - 20
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m

@@ -127,10 +127,10 @@
             NSLog(@"-------requestUrlError %@- %@",myUrl ,error.description);
             faliure(error);
             if (error.code == -1001) {
-                [self showMessage:@"网络请求超时"];
+                [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络请求超时"];
             }
             else if (error.code != -999) {
-                [self showMessage:@"网络错误,请检查您的网络"];
+                [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络错误,请检查您的网络"];
             }
             
         }];
@@ -164,10 +164,10 @@
             NSLog(@"%@",error.description);
             faliure(error);
             if (error.code == -1001) {
-                [self showMessage:@"网络请求超时"];
+                [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络请求超时"];
             }
             else if (error.code != -999) {
-                [self showMessage:@"网络错误,请检查您的网络"];
+                [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络错误,请检查您的网络"];
             }
             
         }];
@@ -198,19 +198,6 @@
     [[VoNetworking sharedManager] cancleAllRequest];
 }
 
-// 提示信息
-+ (void)showMessage:(NSString *)message {
-    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication].windows lastObject] animated:YES];
-    hud.removeFromSuperViewOnHide =YES;
-    hud.mode = MBProgressHUDModeText;
-    hud.label.text = message;
-    hud.minSize = CGSizeMake(132.f, 60.0f);
-    hud.label.textColor = [UIColor whiteColor];
-    hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-    hud.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
-    [hud hideAnimated:YES afterDelay:2];
-}
-
 // 多文件上传
 + (void)uploadMultiFileWithFileArray:(NSArray *)datas
                           andWithUrl:(NSString *)myUrl
@@ -232,7 +219,7 @@
         }
         success(dics);
     } failBlock:^(NSArray *errors) {
-        [self showMessage:@"网络错误,请检查您的网络"];
+        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络错误,请检查您的网络"];
         faliure([errors lastObject]);
     }];
     
@@ -262,7 +249,7 @@
         return ;
     } failBlock:^(NSError *error) {
         faliure(error);
-        [self showMessage:@"网络错误,请检查您的网络"];
+        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络错误,请检查您的网络"];
     }];
 }
 
@@ -298,7 +285,7 @@
         NSMutableArray *result = [NSMutableArray arrayWithArray:responses];
         success(result);
     } failBlock:^(NSArray * _Nonnull errors) {
-        [self showMessage:@"网络错误,请检查您的网络"];
+        [LOADING_MANAGER MBShowAUTOHidingInWindow:@"网络错误,请检查您的网络"];
         faliure([errors lastObject]);
     }];
 }

+ 1 - 14
KulexiuForTeacher/KulexiuForTeacher/Module/Login/Model/UserInfoManager.m

@@ -61,7 +61,7 @@
                     return;
                 }
             }
-            [self showMessage:@"登录过期,请重新登录"];
+            [LOADING_MANAGER MBShowAUTOHidingInWindow:@"登录过期,请重新登录"];
             [APPLOGIN_MANAGER logoutAction];
         }
     });
@@ -75,19 +75,6 @@
     }];
 }
 
-// 提示信息
-- (void)showMessage:(NSString *)message {
-    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication].windows lastObject] animated:YES];
-    hud.removeFromSuperViewOnHide =YES;
-    hud.mode = MBProgressHUDModeText;
-    hud.label.text = message;
-    hud.minSize = CGSizeMake(132.f, 60.0f);
-    hud.label.textColor = [UIColor whiteColor];
-    hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-    hud.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
-    [hud hideAnimated:YES afterDelay:2];
-}
-
 // 获取信息回调
 - (void)queryUserInfoCallback:(UserInfoCallback)callback {
     if (callback) {

+ 1 - 16
KulexiuForTeacher/KulexiuForTeacher/Module/TXClassRoom/Controller/TXClassroomViewController.m

@@ -21,7 +21,6 @@
 
 #import "Classroom.h"
 #import "ClassroomService.h"
-#import <MBProgressHUD/MBProgressHUD.h>
 #import "AppDelegate.h"
 #import "KSWhiteboardControl.h"
 #import <KSToolLibrary/UIDevice+TFDevice.h>
@@ -337,7 +336,7 @@
 
 #pragma mark ----- 账号异地登陆
 - (void)leaveRoomAction {
-    [self showMessage:@"该账号在其他设备上登录"];
+    [LOADING_MANAGER MBShowAUTOHidingInWindow:@"该账号在其他设备上登录"];
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         self.isQuitRoom = YES;
         [[LoginHelper sharedInstance] logout];
@@ -363,20 +362,6 @@
     });
 }
 
-// 提示信息
-- (void)showMessage:(NSString *)message {
-    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
-    [self.view bringSubviewToFront:hud];
-    hud.removeFromSuperViewOnHide =YES;
-    hud.mode = MBProgressHUDModeText;
-    hud.label.text = message;
-    hud.minSize = CGSizeMake(132.f, 60.0f);
-    hud.label.textColor = [UIColor whiteColor];
-    hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
-    hud.bezelView.backgroundColor = HexRGBAlpha(0x000000, 0.8);
-    [hud hideAnimated:YES afterDelay:2];
-}
-
 - (void)tapGesture: (UITapGestureRecognizer *)tapGesture {
     if (self.titleView.isDisplay) {
         self.titleView.isDisplay = NO;