Przeglądaj źródła

1.完成iOS Apex Drivers重复加载。

Pen Li 7 lat temu
rodzic
commit
a679966fb8

+ 2 - 0
Redant Drivers/Apex And Drivers/BaseViewController/RABaseViewController.h

@@ -10,6 +10,8 @@
 
 @interface RABaseViewController : UIViewController
 
+@property (nonatomic,assign) BOOL loading;
+
 + (NSString *)storyboardID;
 
 + (instancetype)viewControllerFromStoryboard;

+ 6 - 1
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.m

@@ -148,6 +148,11 @@
 
 - (void)loadData {
     
+    if (self.loading) {
+        return;
+    }
+    self.loading = YES;
+    
     // show progress
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
@@ -195,7 +200,7 @@
                     [strongSelf showAlertTilte:@"Warning" message:msg];
                 }
             }
-            
+            self.loading = NO;
         });
         
     });

+ 6 - 0
Redant Drivers/Apex And Drivers/Home/More/RAHomeMoreViewController.m

@@ -162,6 +162,11 @@ typedef enum {
 
 - (void)loadData:(LoadDataActionType)actionType {
     
+    if (self.loading) {
+        return;
+    }
+    self.loading = YES;
+    
     NSInteger offset = 0;
     if (actionType == LoadDataActionTypeLoadMore) {
         offset = self.orderCount;
@@ -226,6 +231,7 @@ typedef enum {
                 }
             }
             
+            self.loading = NO;
         });
         
     });

+ 6 - 0
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m

@@ -232,6 +232,11 @@
 
 - (void)loadData {
     
+    if (self.loading) {
+        return;
+    }
+    self.loading = YES;
+    
     // show progress
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
@@ -304,6 +309,7 @@
                 }
             }
             
+            self.loading = NO;
         });
         
     });

+ 6 - 1
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -204,6 +204,11 @@
 
 - (void)loadData {
     
+    if (self.loading) {
+        return;
+    }
+    self.loading = YES;
+    
     // show progress
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
@@ -251,7 +256,7 @@
                     [strongSelf showAlertTilte:@"Warning" message:msg];
                 }
             }
-            
+            self.loading = NO;
         });
         
     });