Jelajahi Sumber

1.修改iOS Apex Drivers增加Empty Data View。

Pen Li 7 tahun lalu
induk
melakukan
241d8bf974

+ 34 - 0
Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj

@@ -141,6 +141,9 @@
 		42D8B8DB20C279AA001C125F /* RAOrderDetailViewController+TableViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D8B8DA20C279AA001C125F /* RAOrderDetailViewController+TableViewDataSource.m */; };
 		42D8B8DB20C279AA001C125F /* RAOrderDetailViewController+TableViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D8B8DA20C279AA001C125F /* RAOrderDetailViewController+TableViewDataSource.m */; };
 		42D8B8DE20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D8B8DD20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m */; };
 		42D8B8DE20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D8B8DD20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m */; };
 		42D8B8E020C28755001C125F /* fake_order_detail.json in Resources */ = {isa = PBXBuildFile; fileRef = 42D8B8DF20C28755001C125F /* fake_order_detail.json */; };
 		42D8B8E020C28755001C125F /* fake_order_detail.json in Resources */ = {isa = PBXBuildFile; fileRef = 42D8B8DF20C28755001C125F /* fake_order_detail.json */; };
+		42DFE265213F80AF000213C2 /* RAEmptyDataView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DFE262213F80AF000213C2 /* RAEmptyDataView.m */; };
+		42DFE266213F80AF000213C2 /* UIScrollView+Empty.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DFE264213F80AF000213C2 /* UIScrollView+Empty.m */; };
+		42DFE26A213F821E000213C2 /* RAEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DFE269213F821E000213C2 /* RAEmptyView.m */; };
 		42ED62D920F85ADB00E08CCB /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 42ED62D820F85ADB00E08CCB /* NotificationService.m */; };
 		42ED62D920F85ADB00E08CCB /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 42ED62D820F85ADB00E08CCB /* NotificationService.m */; };
 		42ED62DD20F85ADB00E08CCB /* RADriversNotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 42ED62D520F85ADB00E08CCB /* RADriversNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		42ED62DD20F85ADB00E08CCB /* RADriversNotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 42ED62D520F85ADB00E08CCB /* RADriversNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		42F0C5D720E20B3F00922442 /* RACameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42F0C5D620E20B3E00922442 /* RACameraViewController.m */; };
 		42F0C5D720E20B3F00922442 /* RACameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42F0C5D620E20B3E00922442 /* RACameraViewController.m */; };
@@ -423,6 +426,12 @@
 		42D8B8DC20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RAOrderDetailViewController+TableViewDelegate.h"; sourceTree = "<group>"; };
 		42D8B8DC20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RAOrderDetailViewController+TableViewDelegate.h"; sourceTree = "<group>"; };
 		42D8B8DD20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RAOrderDetailViewController+TableViewDelegate.m"; sourceTree = "<group>"; };
 		42D8B8DD20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "RAOrderDetailViewController+TableViewDelegate.m"; sourceTree = "<group>"; };
 		42D8B8DF20C28755001C125F /* fake_order_detail.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = fake_order_detail.json; sourceTree = "<group>"; };
 		42D8B8DF20C28755001C125F /* fake_order_detail.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = fake_order_detail.json; sourceTree = "<group>"; };
+		42DFE261213F80AF000213C2 /* RAEmptyDataView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAEmptyDataView.h; sourceTree = "<group>"; };
+		42DFE262213F80AF000213C2 /* RAEmptyDataView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAEmptyDataView.m; sourceTree = "<group>"; };
+		42DFE263213F80AF000213C2 /* UIScrollView+Empty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+Empty.h"; sourceTree = "<group>"; };
+		42DFE264213F80AF000213C2 /* UIScrollView+Empty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+Empty.m"; sourceTree = "<group>"; };
+		42DFE268213F821E000213C2 /* RAEmptyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAEmptyView.h; sourceTree = "<group>"; };
+		42DFE269213F821E000213C2 /* RAEmptyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAEmptyView.m; sourceTree = "<group>"; };
 		42ED62D520F85ADB00E08CCB /* RADriversNotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = RADriversNotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
 		42ED62D520F85ADB00E08CCB /* RADriversNotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = RADriversNotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
 		42ED62D720F85ADB00E08CCB /* NotificationService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = "<group>"; };
 		42ED62D720F85ADB00E08CCB /* NotificationService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = "<group>"; };
 		42ED62D820F85ADB00E08CCB /* NotificationService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationService.m; sourceTree = "<group>"; };
 		42ED62D820F85ADB00E08CCB /* NotificationService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationService.m; sourceTree = "<group>"; };
@@ -980,6 +989,26 @@
 			path = Collection;
 			path = Collection;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
 		};
 		};
+		42DFE260213F80AF000213C2 /* UIScrollVIew+Empty */ = {
+			isa = PBXGroup;
+			children = (
+				42DFE261213F80AF000213C2 /* RAEmptyDataView.h */,
+				42DFE262213F80AF000213C2 /* RAEmptyDataView.m */,
+				42DFE263213F80AF000213C2 /* UIScrollView+Empty.h */,
+				42DFE264213F80AF000213C2 /* UIScrollView+Empty.m */,
+			);
+			path = "UIScrollVIew+Empty";
+			sourceTree = "<group>";
+		};
+		42DFE267213F81F8000213C2 /* EmptyView */ = {
+			isa = PBXGroup;
+			children = (
+				42DFE268213F821E000213C2 /* RAEmptyView.h */,
+				42DFE269213F821E000213C2 /* RAEmptyView.m */,
+			);
+			path = EmptyView;
+			sourceTree = "<group>";
+		};
 		42ED62D620F85ADB00E08CCB /* RADriversNotificationService */ = {
 		42ED62D620F85ADB00E08CCB /* RADriversNotificationService */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
@@ -1019,6 +1048,8 @@
 		71EAA33020B9571B002F003C /* Apex And Drivers */ = {
 		71EAA33020B9571B002F003C /* Apex And Drivers */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				42DFE267213F81F8000213C2 /* EmptyView */,
+				42DFE260213F80AF000213C2 /* UIScrollVIew+Empty */,
 				422DA1BD2134FA510021BD70 /* PresentationController */,
 				422DA1BD2134FA510021BD70 /* PresentationController */,
 				71EAA34720B957D5002F003C /* Apex And Drivers.entitlements */,
 				71EAA34720B957D5002F003C /* Apex And Drivers.entitlements */,
 				42810FF420E4D46F00315156 /* Refresh */,
 				42810FF420E4D46F00315156 /* Refresh */,
@@ -1221,6 +1252,8 @@
 				420D11092133EE5D00149B37 /* RAOrderFilterSectionModel.m in Sources */,
 				420D11092133EE5D00149B37 /* RAOrderFilterSectionModel.m in Sources */,
 				42D8B8DE20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m in Sources */,
 				42D8B8DE20C279BA001C125F /* RAOrderDetailViewController+TableViewDelegate.m in Sources */,
 				425B97E520C7BD3800B35713 /* UIView+Toast.m in Sources */,
 				425B97E520C7BD3800B35713 /* UIView+Toast.m in Sources */,
+				42DFE26A213F821E000213C2 /* RAEmptyView.m in Sources */,
+				42DFE265213F80AF000213C2 /* RAEmptyDataView.m in Sources */,
 				42529D2B20C0EA0A000C0F4D /* RAUtils.m in Sources */,
 				42529D2B20C0EA0A000C0F4D /* RAUtils.m in Sources */,
 				4281100420E4D47000315156 /* UIScrollView+JLRefresh.m in Sources */,
 				4281100420E4D47000315156 /* UIScrollView+JLRefresh.m in Sources */,
 				4205FD6620C13BF400DB42B4 /* RAOrderCell.m in Sources */,
 				4205FD6620C13BF400DB42B4 /* RAOrderCell.m in Sources */,
@@ -1298,6 +1331,7 @@
 				71EAA34120B95720002F003C /* main.m in Sources */,
 				71EAA34120B95720002F003C /* main.m in Sources */,
 				4255EC6E20C4E29B00E5DA24 /* RADetailActionSelectionCell.m in Sources */,
 				4255EC6E20C4E29B00E5DA24 /* RADetailActionSelectionCell.m in Sources */,
 				4205FD4820C0F33500DB42B4 /* LoginViewController.m in Sources */,
 				4205FD4820C0F33500DB42B4 /* LoginViewController.m in Sources */,
+				42DFE266213F80AF000213C2 /* UIScrollView+Empty.m in Sources */,
 				4235FAB6213E30CC000B6672 /* RAEditImageBaseModel.m in Sources */,
 				4235FAB6213E30CC000B6672 /* RAEditImageBaseModel.m in Sources */,
 				4281100320E4D47000315156 /* JLRefreshBasis.m in Sources */,
 				4281100320E4D47000315156 /* JLRefreshBasis.m in Sources */,
 				420D11182133F06900149B37 /* RAOrderFilterStatusCell.m in Sources */,
 				420D11182133F06900149B37 /* RAOrderFilterStatusCell.m in Sources */,

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

@@ -17,6 +17,8 @@
 #import "RADetailSignatureModel.h"
 #import "RADetailSignatureModel.h"
 
 
 #import "RAProgressHUD.h"
 #import "RAProgressHUD.h"
+#import "UIScrollView+Empty.h"
+#import "RAEmptyView.h"
 
 
 @interface RAOrderDetailSectionModel : NSObject
 @interface RAOrderDetailSectionModel : NSObject
 
 
@@ -160,6 +162,12 @@
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [self.detailTableView addSubview:refresh];
     [self.detailTableView addSubview:refresh];
     self.refreshControl = refresh;
     self.refreshControl = refresh;
+    
+    // empty
+    __weak typeof(self) weakSelf = self;
+    self.detailTableView.emptyView = [RAEmptyView emptyViewWithTapBlk:^(id sender) {
+        [weakSelf loadData];
+    }];
 }
 }
 
 
 #pragma mark - Action
 #pragma mark - Action
@@ -177,6 +185,8 @@
     }
     }
     self.loading = YES;
     self.loading = YES;
     
     
+    [self.detailTableView hideEmpty];
+    
     // show progress
     // show progress
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     
@@ -224,7 +234,13 @@
                     [strongSelf showAlertTilte:@"Warning" message:msg];
                     [strongSelf showAlertTilte:@"Warning" message:msg];
                 }
                 }
             }
             }
-            self.loading = NO;
+            weakSelf.loading = NO;
+            
+            if (weakSelf.sectionNumber == 0) {
+                [weakSelf.detailTableView showEmpty];
+            } else {
+                [weakSelf.detailTableView hideEmpty];
+            }
         });
         });
         
         
     });
     });

+ 15 - 0
Redant Drivers/Apex And Drivers/EmptyView/RAEmptyView.h

@@ -0,0 +1,15 @@
+//
+//  RAEmptyView.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/9/5.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface RAEmptyView : UIView
+
++ (instancetype)emptyViewWithTapBlk:(void(^)(id sender))tapEmptyBlk;
+
+@end

+ 65 - 0
Redant Drivers/Apex And Drivers/EmptyView/RAEmptyView.m

@@ -0,0 +1,65 @@
+//
+//  RAEmptyView.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/9/5.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RAEmptyView.h"
+
+@interface RAEmptyView ()
+
+@property (nonatomic,copy) void(^tapEmptyBlk)(id sender);
+@property (nonatomic,strong) UILabel *tipLabel;
+
+@end
+
+@implementation RAEmptyView
+
++ (instancetype)emptyViewWithTapBlk:(void(^)(id sender))tapEmptyBlk {
+    RAEmptyView *emptyView = [RAEmptyView new];
+    emptyView.frame = CGRectMake(0, 0, 200, 80);
+    emptyView.tapEmptyBlk = tapEmptyBlk;
+    
+    return emptyView;
+}
+
+- (instancetype)init {
+    
+    if (self = [super init]) {
+        self.layer.borderColor = [UIColor grayColor].CGColor;
+        self.layer.borderWidth = 0.5f;
+        self.layer.cornerRadius = 5.0f;
+        self.layer.masksToBounds = YES;
+        [self addSubview:self.tipLabel];
+        
+        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEmpty:)];
+        [self addGestureRecognizer:tap];
+    }
+    return self;
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    
+    self.tipLabel.frame = self.bounds;
+}
+
+- (UILabel *)tipLabel {
+    if (!_tipLabel) {
+        _tipLabel = [[UILabel alloc] init];
+        _tipLabel.text = @"There is no data\nPlease click to reload";
+        _tipLabel.numberOfLines = 0;
+        _tipLabel.textAlignment = NSTextAlignmentCenter;
+    }
+    return _tipLabel;
+}
+
+- (void)tapEmpty:(UITapGestureRecognizer *)tap {
+    if (self.tapEmptyBlk) {
+        self.tapEmptyBlk(tap);
+    }
+}
+
+@end

+ 17 - 1
Redant Drivers/Apex And Drivers/Home/More/RAHomeMoreViewController.m

@@ -11,6 +11,8 @@
 #import "RAOrderDetailViewController.h"
 #import "RAOrderDetailViewController.h"
 #import "JLRefreshFooter.h"
 #import "JLRefreshFooter.h"
 #import "RAOrderFilterViewController.h"
 #import "RAOrderFilterViewController.h"
+#import "UIScrollView+Empty.h"
+#import "RAEmptyView.h"
 
 
 static const NSInteger limit = 20;
 static const NSInteger limit = 20;
 
 
@@ -91,6 +93,12 @@ typedef enum {
     self.refreshFooter = [[JLRefreshFooter alloc] init];
     self.refreshFooter = [[JLRefreshFooter alloc] init];
     self.refreshFooter.refreshDelegate = self;
     self.refreshFooter.refreshDelegate = self;
     self.homeMoreTableView.jl_footer = self.refreshFooter;
     self.homeMoreTableView.jl_footer = self.refreshFooter;
+    
+    // empty
+    __weak typeof(self) weakSelf = self;
+    self.homeMoreTableView.emptyView = [RAEmptyView emptyViewWithTapBlk:^(id sender) {
+        [weakSelf loadData];
+    }];
 }
 }
 
 
 - (void)registNotification {
 - (void)registNotification {
@@ -167,6 +175,8 @@ typedef enum {
     }
     }
     self.loading = YES;
     self.loading = YES;
     
     
+    [self.homeMoreTableView hideEmpty];
+    
     NSInteger offset = 0;
     NSInteger offset = 0;
     if (actionType == LoadDataActionTypeLoadMore) {
     if (actionType == LoadDataActionTypeLoadMore) {
         offset = self.orderCount;
         offset = self.orderCount;
@@ -231,7 +241,13 @@ typedef enum {
                 }
                 }
             }
             }
             
             
-            self.loading = NO;
+            weakSelf.loading = NO;
+            
+            if (weakSelf.orderCount == 0) {
+                [weakSelf.homeMoreTableView showEmpty];
+            } else {
+                [weakSelf.homeMoreTableView hideEmpty];
+            }
         });
         });
         
         
     });
     });

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

@@ -13,6 +13,8 @@
 #import "ApexDriverUploadListVC.h"
 #import "ApexDriverUploadListVC.h"
 #import "RAHomeMoreViewController.h"
 #import "RAHomeMoreViewController.h"
 #import <UserNotifications/UserNotifications.h>
 #import <UserNotifications/UserNotifications.h>
+#import "UIScrollView+Empty.h"
+#import "RAEmptyView.h"
 
 
 @interface RAHomeSectionModel : NSObject
 @interface RAHomeSectionModel : NSObject
 
 
@@ -134,6 +136,12 @@
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [self.homeOrderTableView addSubview:refresh];
     [self.homeOrderTableView addSubview:refresh];
     self.refreshControl = refresh;
     self.refreshControl = refresh;
+    
+    // empty
+    __weak typeof(self) weakSelf = self;
+    self.homeOrderTableView.emptyView = [RAEmptyView emptyViewWithTapBlk:^(id sender) {
+        [weakSelf loadData];
+    }];
 }
 }
 
 
 - (void)configureNavigationBar {
 - (void)configureNavigationBar {
@@ -238,6 +246,8 @@
     }
     }
     self.loading = YES;
     self.loading = YES;
     
     
+    [self.homeOrderTableView hideEmpty];
+    
     // show progress
     // show progress
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     
@@ -291,11 +301,7 @@
                     } else {
                     } else {
                         
                         
                     }
                     }
-//                    
-//                    [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
-//                    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
-//                    [center removeAllDeliveredNotifications];
-//                    [center removeAllPendingNotificationRequests];
+
                     
                     
                 } else {
                 } else {
                     
                     
@@ -310,7 +316,13 @@
                 }
                 }
             }
             }
             
             
-            self.loading = NO;
+            weakSelf.loading = NO;
+            
+            if (weakSelf.orderSectionCount == 0) {
+                [weakSelf.homeOrderTableView showEmpty];
+            } else {
+                [weakSelf.homeOrderTableView hideEmpty];
+            }
         });
         });
         
         
     });
     });

+ 15 - 0
Redant Drivers/Apex And Drivers/UIScrollVIew+Empty/RAEmptyDataView.h

@@ -0,0 +1,15 @@
+//
+//  RAEmptyDataView.h
+//  UIScrollViewEmpty
+//
+//  Created by Jack on 2018/9/5.
+//  Copyright © 2018年 United Software Applications. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface RAEmptyDataView : UIView
+
+@property (nonatomic,strong) UIView *emptyView;
+
+@end

+ 107 - 0
Redant Drivers/Apex And Drivers/UIScrollVIew+Empty/RAEmptyDataView.m

@@ -0,0 +1,107 @@
+//
+//  RAEmptyDataView.m
+//  UIScrollViewEmpty
+//
+//  Created by Jack on 2018/9/5.
+//  Copyright © 2018年 United Software Applications. All rights reserved.
+//
+
+#import "RAEmptyDataView.h"
+
+@implementation RAEmptyDataView
+
+#pragma mark - Initial
+
+- (instancetype)init {
+    if (self = [super init]) {
+        self.backgroundColor = [UIColor whiteColor];
+//        self.translatesAutoresizingMaskIntoConstraints = NO;
+    }
+    return self;
+}
+
+- (void)setFrame:(CGRect)frame {
+    [super setFrame:frame];
+}
+
+- (void)didMoveToSuperview {
+    [super didMoveToSuperview];
+    self.frame = self.superview.bounds;
+}
+
+- (void)willMoveToSuperview:(UIView *)newSuperview {
+    [super willMoveToSuperview:newSuperview];
+}
+
+- (void)setHidden:(BOOL)hidden {
+    [super setHidden:hidden];
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    
+    if (self.emptyView) {
+        
+        CGFloat w = self.bounds.size.width;
+        CGFloat h = self.bounds.size.height;
+        CGFloat emptyW = self.emptyView.bounds.size.width;
+        CGFloat emptyH = self.emptyView.bounds.size.height;
+        
+        CGFloat x = (w - emptyW) * 0.5;
+        CGFloat y = (h - emptyH) * 0.5;
+        self.emptyView.frame = CGRectMake(x, y, emptyW, emptyH);
+    }
+}
+
+- (void)clear {
+    NSArray *subviews = self.subviews;
+    if (subviews && subviews.count > 0) {
+        for (UIView *subview in subviews) {
+            [subview removeFromSuperview];
+        }
+    }
+}
+
+- (void)setEmptyView:(UIView *)emptyView {
+    _emptyView = emptyView;
+    
+    [self clear];
+    [self addSubview:_emptyView];
+
+//    NSLayoutConstraint *enterX = [NSLayoutConstraint constraintWithItem:_emptyView
+//                                                             attribute:NSLayoutAttributeCenterX
+//                                                             relatedBy:NSLayoutRelationEqual
+//                                                                toItem:self
+//                                                             attribute:NSLayoutAttributeCenterX
+//                                                            multiplier:1
+//                                                              constant:0];
+//
+//    NSLayoutConstraint *enterY = [NSLayoutConstraint constraintWithItem:_emptyView
+//                                                              attribute:NSLayoutAttributeCenterY
+//                                                              relatedBy:NSLayoutRelationEqual
+//                                                                 toItem:self
+//                                                              attribute:NSLayoutAttributeCenterY
+//                                                             multiplier:1
+//                                                               constant:0];
+//
+//    NSLayoutConstraint *w = [NSLayoutConstraint constraintWithItem:_emptyView
+//                                                              attribute:NSLayoutAttributeWidth
+//                                                              relatedBy:NSLayoutRelationEqual
+//                                                                 toItem:nil
+//                                                              attribute:NSLayoutAttributeNotAnAttribute
+//                                                             multiplier:1
+//                                                               constant:100];
+//
+//    NSLayoutConstraint *h = [NSLayoutConstraint constraintWithItem:_emptyView
+//                                                              attribute:NSLayoutAttributeHeight
+//                                                              relatedBy:NSLayoutRelationEqual
+//                                                                 toItem:nil
+//                                                              attribute:NSLayoutAttributeNotAnAttribute
+//                                                             multiplier:1
+//                                                               constant:70];
+//
+//
+//    [self addConstraints:@[enterX,enterY,w,h]];
+}
+
+@end

+ 19 - 0
Redant Drivers/Apex And Drivers/UIScrollVIew+Empty/UIScrollView+Empty.h

@@ -0,0 +1,19 @@
+//
+//  UIScrollView+Empty.h
+//  UIScrollViewEmpty
+//
+//  Created by Jack on 2018/9/5.
+//  Copyright © 2018年 United Software Applications. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface UIScrollView (Empty)
+
+@property (nonatomic,strong) UIView *emptyView;
+
+- (void)showEmpty;
+
+- (void)hideEmpty;
+
+@end

+ 76 - 0
Redant Drivers/Apex And Drivers/UIScrollVIew+Empty/UIScrollView+Empty.m

@@ -0,0 +1,76 @@
+//
+//  UIScrollView+Empty.m
+//  UIScrollViewEmpty
+//
+//  Created by Jack on 2018/9/5.
+//  Copyright © 2018年 United Software Applications. All rights reserved.
+//
+
+#import "UIScrollView+Empty.h"
+#import "RAEmptyDataView.h"
+#import <objc/runtime.h>
+
+static const char *emptyKey = "emptyKey";
+
+static const float duration = 0.25;
+
+@implementation UIScrollView (Empty)
+
+- (void)setEmptyContentView:(RAEmptyDataView *)contentView {
+    if (contentView) {
+        UIView *view = objc_getAssociatedObject(self, emptyKey);
+        if (view) {
+            [view removeFromSuperview];
+        }
+        
+        [self insertSubview:contentView atIndex:0];
+        
+        [self willChangeValueForKey:@"emptyView"];
+        objc_setAssociatedObject(self, emptyKey, contentView, OBJC_ASSOCIATION_RETAIN);
+        [self didChangeValueForKey:@"emptyView"];
+    }
+}
+
+- (RAEmptyDataView *)emptyContentView {
+    
+    RAEmptyDataView *contentView = objc_getAssociatedObject(self, emptyKey);
+    
+    if (!contentView) {
+        contentView = [RAEmptyDataView new];
+        contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
+        contentView.hidden = YES;
+        
+        [self setEmptyContentView:contentView];
+    }
+    
+    return contentView;
+}
+
+- (void)setEmptyView:(UIView *)emptyView {
+    [self emptyContentView].emptyView = emptyView;
+}
+
+- (UIView *)emptyView {
+    return [self emptyContentView].emptyView;
+}
+
+- (void)showEmpty {
+    UIView *view = [self emptyContentView];
+//    view.alpha = 0.0f;
+    view.hidden = NO;
+    
+//    [UIView animateWithDuration:duration animations:^{
+//        view.alpha = 1.0f;
+//    }];
+}
+
+- (void)hideEmpty {
+    UIView *view = [self emptyContentView];
+//    [UIView animateWithDuration:duration animations:^{
+//        view.alpha = 0.0f;
+//    } completion:^(BOOL finished) {
+        view.hidden = YES;
+//    }];
+}
+
+@end

+ 17 - 2
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -18,7 +18,8 @@
 #import "RAProgressHUD.h"
 #import "RAProgressHUD.h"
 #import "ZipArchive.h"
 #import "ZipArchive.h"
 #import "AppDelegate.h"
 #import "AppDelegate.h"
-
+#import "UIScrollView+Empty.h"
+#import "RAEmptyView.h"
 
 
 #import <CoreLocation/CoreLocation.h>
 #import <CoreLocation/CoreLocation.h>
 
 
@@ -158,6 +159,12 @@
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [self.orderEditTableView addSubview:refresh];
     [self.orderEditTableView addSubview:refresh];
     self.refreshControl = refresh;
     self.refreshControl = refresh;
+    
+    // empty
+    __weak typeof(self) weakSelf = self;
+    self.orderEditTableView.emptyView = [RAEmptyView emptyViewWithTapBlk:^(id sender) {
+        [weakSelf loadData];
+    }];
 }
 }
 
 
 - (void)configureNavigationBar {
 - (void)configureNavigationBar {
@@ -219,6 +226,8 @@
     }
     }
     self.loading = YES;
     self.loading = YES;
     
     
+    [self.orderEditTableView hideEmpty];
+    
     // show progress
     // show progress
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
     
     
@@ -266,7 +275,13 @@
                     [strongSelf showAlertTilte:@"Warning" message:msg];
                     [strongSelf showAlertTilte:@"Warning" message:msg];
                 }
                 }
             }
             }
-            self.loading = NO;
+            weakSelf.loading = NO;
+            
+            if (weakSelf.editSectionCount  == 0) {
+                [weakSelf.orderEditTableView showEmpty];
+            } else {
+                [weakSelf.orderEditTableView hideEmpty];
+            }
         });
         });
         
         
     });
     });