Просмотр исходного кода

1.修改iOS Apex Mobile KPI,重新布局。

Pen Li 8 лет назад
Родитель
Сommit
ac6b34674e

+ 24 - 0
Apex Mobile/Apex Mobile.xcodeproj/project.pbxproj

@@ -39,6 +39,11 @@
 		427CF5E6202454750041472A /* GoogleMapsBase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 427CF5E3202454750041472A /* GoogleMapsBase.framework */; };
 		427CF5E7202454750041472A /* GoogleMapsCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 427CF5E4202454750041472A /* GoogleMapsCore.framework */; };
 		427CF5E9202454860041472A /* GoogleMaps.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 427CF5E8202454860041472A /* GoogleMaps.bundle */; };
+		42BB7402208431DA00B9B6E4 /* KPILegendCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BB7401208431DA00B9B6E4 /* KPILegendCell.m */; };
+		42BB740620846B4500B9B6E4 /* KPITableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BB740420846B4500B9B6E4 /* KPITableCell.m */; };
+		42BB740720846B4500B9B6E4 /* KPITableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42BB740520846B4500B9B6E4 /* KPITableCell.xib */; };
+		42BB74092084732D00B9B6E4 /* KPICell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42BB74082084732D00B9B6E4 /* KPICell.xib */; };
+		42BB740B2084737800B9B6E4 /* KPILegendCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42BB740A2084737800B9B6E4 /* KPILegendCell.xib */; };
 		42BFD2D2207B697800DA9038 /* KPICell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42BFD2D1207B697800DA9038 /* KPICell.m */; };
 		7101BEC82031389A00CC6E3A /* DetailCellKVNew.m in Sources */ = {isa = PBXBuildFile; fileRef = 7101BEC72031389A00CC6E3A /* DetailCellKVNew.m */; };
 		711BA6C1191E0525002EDE6F /* MessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 711BA6C0191E0525002EDE6F /* MessageViewController.m */; };
@@ -233,6 +238,13 @@
 		427CF5E3202454750041472A /* GoogleMapsBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GoogleMapsBase.framework; sourceTree = "<group>"; };
 		427CF5E4202454750041472A /* GoogleMapsCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GoogleMapsCore.framework; sourceTree = "<group>"; };
 		427CF5E8202454860041472A /* GoogleMaps.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = GoogleMaps.bundle; path = GoogleMaps.framework/Versions/A/Resources/GoogleMaps.bundle; sourceTree = "<group>"; };
+		42BB7400208431DA00B9B6E4 /* KPILegendCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPILegendCell.h; sourceTree = "<group>"; };
+		42BB7401208431DA00B9B6E4 /* KPILegendCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KPILegendCell.m; sourceTree = "<group>"; };
+		42BB740320846B4500B9B6E4 /* KPITableCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPITableCell.h; sourceTree = "<group>"; };
+		42BB740420846B4500B9B6E4 /* KPITableCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KPITableCell.m; sourceTree = "<group>"; };
+		42BB740520846B4500B9B6E4 /* KPITableCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KPITableCell.xib; sourceTree = "<group>"; };
+		42BB74082084732D00B9B6E4 /* KPICell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KPICell.xib; sourceTree = "<group>"; };
+		42BB740A2084737800B9B6E4 /* KPILegendCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KPILegendCell.xib; sourceTree = "<group>"; };
 		42BFD2D0207B697800DA9038 /* KPICell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KPICell.h; sourceTree = "<group>"; };
 		42BFD2D1207B697800DA9038 /* KPICell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KPICell.m; sourceTree = "<group>"; };
 		7101BEC62031389A00CC6E3A /* DetailCellKVNew.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DetailCellKVNew.h; sourceTree = "<group>"; };
@@ -524,6 +536,13 @@
 				42539028207A159300ECF982 /* KPIButton.m */,
 				42BFD2D0207B697800DA9038 /* KPICell.h */,
 				42BFD2D1207B697800DA9038 /* KPICell.m */,
+				42BB74082084732D00B9B6E4 /* KPICell.xib */,
+				42BB7400208431DA00B9B6E4 /* KPILegendCell.h */,
+				42BB7401208431DA00B9B6E4 /* KPILegendCell.m */,
+				42BB740A2084737800B9B6E4 /* KPILegendCell.xib */,
+				42BB740320846B4500B9B6E4 /* KPITableCell.h */,
+				42BB740420846B4500B9B6E4 /* KPITableCell.m */,
+				42BB740520846B4500B9B6E4 /* KPITableCell.xib */,
 			);
 			name = Cell;
 			sourceTree = "<group>";
@@ -1250,12 +1269,15 @@
 				714C39BF19234065004F045B /* Localizable.strings in Resources */,
 				427CF5D02023F5560041472A /* NewImages.xcassets in Resources */,
 				425660DB202015E1002DB0CA /* Launch.storyboard in Resources */,
+				42BB740B2084737800B9B6E4 /* KPILegendCell.xib in Resources */,
 				425390262079B9B500ECF982 /* KPI.json in Resources */,
 				715643DA201C079F00B04267 /* tools.json in Resources */,
 				715643D5201AD2AB00B04267 /* StaticModelistViewController.xib in Resources */,
 				71807B9E2021ACE500E1F1DD /* fake_search.json in Resources */,
 				715643B720198A1400B04267 /* Main.storyboard in Resources */,
 				7162546D201C412E009E3A41 /* ShippingStatusCell.xib in Resources */,
+				42BB74092084732D00B9B6E4 /* KPICell.xib in Resources */,
+				42BB740720846B4500B9B6E4 /* KPITableCell.xib in Resources */,
 				719EF8EB18BB839F00EFFF5F /* InfoPlist.strings in Resources */,
 				4235C3052022A60A00A99D04 /* ResultCell.xib in Resources */,
 			);
@@ -1289,6 +1311,7 @@
 				425390202079B99B00ECF982 /* XYCommon.m in Sources */,
 				715709BB20215E0000EFE5C5 /* NSData+Base64.m in Sources */,
 				71375C8F18D96EDE00EBA026 /* TabBarController.m in Sources */,
+				42BB7402208431DA00B9B6E4 /* KPILegendCell.m in Sources */,
 				71951E6F18C6A9A5005024BD /* TouchLabel.m in Sources */,
 				71DA6047190A00F600683003 /* FavoritesData.m in Sources */,
 				425CF099201EB2B500750E32 /* UIScrollView+JLRefresh.m in Sources */,
@@ -1366,6 +1389,7 @@
 				717D76EB18C7F8120070302D /* Reachability.m in Sources */,
 				715709A720215B5100EFE5C5 /* ioapi.c in Sources */,
 				4253900E2079B7C700ECF982 /* KPIPieChartCell.m in Sources */,
+				42BB740620846B4500B9B6E4 /* KPITableCell.m in Sources */,
 				715643CA2019BC4C00B04267 /* SearchlistViewController.m in Sources */,
 				7120DD0418BE273900E7546F /* LocationViewController.m in Sources */,
 				71308AFA191E7B2A0024B2B0 /* MessageDetailViewController.m in Sources */,

+ 181 - 99
Apex Mobile/Apex Mobile/HomeViewController.m

@@ -13,9 +13,15 @@
 #import "DetailTabBarController.h"
 #import "RAUtils.h"
 #import "KPICell.h"
+#import "KPITableCell.h"
 
 #define SHIP_CELL_IDENTIFIER @"ShippingStatusCell"
-#define KPI_CELL_IDENTIFIER @"KPICell"
+#define KPI_CELL_IDENTIFIER @"KPITableCell"
+
+typedef enum {
+    HomeModeRecent = 0,
+    HomeModeKPI = 1
+} HomeMode;
 
 @interface HomeViewController () <UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,KPIDelegate>
 
@@ -23,14 +29,16 @@
 @property (strong, nonatomic) IBOutlet UITableView *shipTableView;
 @property (strong, nonatomic) IBOutlet UISearchBar *shipSearchBar;
 @property (nonatomic,strong) NSMutableArray *shipArray;
-@property (strong, nonatomic) IBOutlet UIButton *emptyBtn;
 @property (nonatomic,strong) UIRefreshControl *refreshControl;
-@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *loadIndicator;
-@property (strong, nonatomic) IBOutlet UICollectionView *KPICollectionView;
+@property (nonatomic,strong) IBOutlet UITableView *KPITableView;
+@property (nonatomic,strong) UIRefreshControl *KPIRefresh;
 
 @property (nonatomic,strong) NSMutableArray *KPIArray;
 @property (nonatomic,strong) NSArray *monthArray;
 
+@property (nonatomic,assign) HomeMode mode;///<
+@property (nonatomic,assign) NSInteger currentKPI;
+
 @end
 
 @implementation HomeViewController
@@ -43,19 +51,10 @@
     } else {
         self.automaticallyAdjustsScrollViewInsets = NO;
     }
-    
+    self.currentKPI = 1;
     self.segmentControl.tintColor = APGRAYCOLOR;
     
-    self.emptyBtn.layer.borderColor = [UIColor darkGrayColor].CGColor;
-    self.emptyBtn.layer.borderWidth = 1.0f;
-    self.emptyBtn.layer.cornerRadius = 10.0f;
-    self.emptyBtn.layer.masksToBounds = YES;
-    self.emptyBtn.hidden = YES;
-    
-    [self.loadIndicator stopAnimating];
-    
     [self registNotification];
-    [self configureCollectionView];
     [self configureTableView];
     self.shipSearchBar.delegate =self;
     
@@ -67,6 +66,7 @@
 //    self.loadIndicator.layer.borderWidth = 0.3f;
 //    self.loadIndicator.color = [UIColor colorWithRed:43 / 255.0 green:43 / 255.0 blue:43 / 255.0 alpha:1.0];
 //    self.loadIndicator.backgroundColor = [UIColor colorWithRed:255 / 255.0 green:255 / 255.0 blue:255 / 255.0 alpha:0.9];
+
 }
 
 - (void)didReceiveMemoryWarning {
@@ -84,6 +84,18 @@
     if (self.shipArray.count == 0) {
         [self loadData];
     }
+    
+    if (self.mode == HomeModeKPI && self.KPIArray.count) {
+        NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count - 2];
+        self.parentViewController.title = str;
+    }
+    
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    
+    self.parentViewController.title = nil;
 }
 
 - (void)clearNavigationbar {
@@ -120,22 +132,29 @@
     self.shipTableView.tableFooterView = [UIView new];
     
     [self.shipTableView registerNib:[UINib nibWithNibName:@"ShippingStatusCell" bundle:nil] forCellReuseIdentifier:SHIP_CELL_IDENTIFIER];
-    [self.shipTableView registerNib:[UINib nibWithNibName:@"KPIPieChartCell" bundle:nil] forCellReuseIdentifier:KPI_CELL_IDENTIFIER];
+    [self.shipTableView registerNib:[UINib nibWithNibName:@"KPITableCell" bundle:nil] forCellReuseIdentifier:KPI_CELL_IDENTIFIER];
     
-//    self.shipTableView.canCancelContentTouches = NO;//是否可以中断touches
-//    self.shipTableView.delaysContentTouches = NO;//是否延迟touches事件
     
     UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
     refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"loading data..."];
     [refresh addTarget:self action:@selector(refreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
     [self.shipTableView addSubview:refresh];
     self.refreshControl = refresh;
-}
-
-- (void)configureCollectionView {
     
-    UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.KPICollectionView.collectionViewLayout;
-    layout.estimatedItemSize = self.KPICollectionView.bounds.size;
+    
+    //  KPI
+    
+    self.KPITableView.tableHeaderView =  [[UIView alloc] initWithFrame:CGRectMake(0, 0, w, CGFLOAT_MIN)];
+    self.KPITableView.tableFooterView = [UIView new];
+    
+    [self.KPITableView registerNib:[UINib nibWithNibName:@"KPITableCell" bundle:nil] forCellReuseIdentifier:KPI_CELL_IDENTIFIER];
+    
+    
+    UIRefreshControl *KPIRefresh = [[UIRefreshControl alloc] init];
+    KPIRefresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"loading data..."];
+    [KPIRefresh addTarget:self action:@selector(KPIRefreshControlValueChanged:) forControlEvents:UIControlEventValueChanged];
+    [self.KPITableView addSubview:KPIRefresh];
+    self.KPIRefresh = KPIRefresh;
 }
 
 - (void)registNotification {
@@ -188,73 +207,101 @@
 //    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
     
     // 避免重复刷新
-    if (self.loadIndicator.isAnimating) {
+    if (self.refreshControl.isRefreshing) {
         return;
     }
     
-//    if (!self.refreshControl.isRefreshing) {
-//
-//    }
-    [self.loadIndicator startAnimating];
+    [self.refreshControl beginRefreshing];
     
     __weak typeof(self) weakSelf = self;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
        
-//        NSDictionary *json = [RANetwork requestHome];
+        NSDictionary *json = [RANetwork requestHome];
+        
+//        NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"fake_home.json" ofType:nil]];
+//        NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
         
-        NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"fake_home.json" ofType:nil]];
-        NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
         dispatch_async(dispatch_get_main_queue(), ^{
             
             if (self.refreshControl.isRefreshing) {
                 [self.refreshControl endRefreshing];
             }
             
-            if (self.loadIndicator.isAnimating) {
-                [self.loadIndicator stopAnimating];
-            }
             
             int result = [[json objectForKey:@"result"] intValue];
             if (result == RESULT_TRUE) {
                 
-                self.monthArray = [json objectForKey:@"month"];
-                
                 [self.shipArray removeAllObjects];
                 [self.shipArray addObjectsFromArray:[json objectForKey:@"container_list"]];
                 [self.shipTableView reloadData];
                 
-                [self.KPIArray removeAllObjects];
+            } else {
+                NSString *msg = [json objectForKey:@"err_msg"];
+                [RAUtils message_alert:msg title:@"Warning" controller:weakSelf];
+            }
+            [self.shipTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
+        });
+        
+    });
+}
+
+- (void)loadKPIData {
+    
+    if (self.KPIRefresh.isRefreshing) {
+        return;
+    }
+    
+    [self.KPIRefresh beginRefreshing];
+    
+    __weak typeof(self) weakSelf = self;
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        
+        NSDictionary *json = [RANetwork requestKPI];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            
+            if (self.KPIRefresh.isRefreshing) {
+                [self.KPIRefresh endRefreshing];
+            }
+            
+            int result = [[json objectForKey:@"result"] intValue];
+            if (result == RESULT_TRUE) {
                 
+                self.monthArray = [json objectForKey:@"month"];
+                
+                [self.KPIArray removeAllObjects];
                 NSArray *kpiArr = [json objectForKey:@"KPI"];
-//                for (int i = 0; i < kpiArr.count; i++) {
-//                    NSMutableDictionary *item = [kpiArr objectAtIndex:i];
-//                    [self.KPIArray addObject:item];
-//                }
-                 
+                
+                [self.KPIArray addObject:[[kpiArr firstObject] mutableCopy]];
                 [self.KPIArray addObjectsFromArray:kpiArr];
-
+                [self.KPIArray addObject:[[kpiArr lastObject] mutableCopy]];
                 
-                [self.KPICollectionView reloadData];
+                
+                [self.KPITableView reloadData];
                 
             } else {
                 NSString *msg = [json objectForKey:@"err_msg"];
                 [RAUtils message_alert:msg title:@"Warning" controller:weakSelf];
             }
-            self.emptyBtn.hidden = self.shipArray.count > 0;
-            [self.shipTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
+//            self.emptyBtn.hidden = self.shipArray.count > 0;
+//            [self.shipTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
         });
         
     });
     
-    
 }
 
 #pragma mark - Actinon
 
 - (void)refreshControlValueChanged:(UIRefreshControl *)refresh {
+
     [self loadData];
 }
 
+- (void)KPIRefreshControlValueChanged:(UIRefreshControl *)refresh {
+    [self loadKPIData];
+}
+
 - (void)searchItemClick:(id)sender {
     
     ShipSearchController *searchVC = [ShipSearchController build];
@@ -263,20 +310,30 @@
     
 }
 
-- (IBAction)emptyBtnClick:(id)sender {
-    self.emptyBtn.hidden = YES;
-    [self loadData];
-}
-
 - (IBAction)modeSegmentClick:(UISegmentedControl *)sender {
     
     if (sender.selectedSegmentIndex == 1) {
+        self.mode = HomeModeKPI;
         self.shipTableView.hidden = YES;
-        self.KPICollectionView.hidden = NO;
+        self.KPITableView.hidden = NO;
+        
+        if (self.KPIArray.count == 0) {
+            [self loadKPIData];
+        } else {
+            NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count - 2];
+            self.parentViewController.title = str;
+        }
+        
+        
     } else {
-        self.KPICollectionView.hidden = YES;
+        self.mode = HomeModeRecent;
+        self.KPITableView.hidden = YES;
         self.shipTableView.hidden = NO;
+        self.parentViewController.title = nil;
     }
+    
+    
+    [self.shipTableView reloadData];
 }
 
 - (void)switchMode:(id)sender {
@@ -306,7 +363,12 @@
 #pragma mark - TableView DataSource && Delegate
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-    return self.shipArray.count;
+    if (self.shipTableView == tableView) {
+        return self.shipArray.count;
+    } else {
+        return 1;
+    }
+    
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -315,21 +377,34 @@
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     
-    ShipingStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:SHIP_CELL_IDENTIFIER forIndexPath:indexPath];
-    
-    NSDictionary *item = [self.shipArray objectAtIndex:indexPath.section];
-    
-    NSString *title = [item objectForKey:@"title"];
-    NSString *icon = [item objectForKey:@"icon"];
-    NSString *desc = [item objectForKey:@"description"];
-    NSString *detail = [item objectForKey:@"detail"];
-    NSString *date = [item objectForKey:@"date"];
-    NSString *port = [item objectForKey:@"port"];
-    NSInteger stage = [[item objectForKey:@"transport_stage"] integerValue];
-    
-    [[[[[[[cell setTitle:title] setDescription:desc] setDetail:detail] setPort:port] setTime:date] setIcon:icon] setTransportStage:stage];
+    if (self.shipTableView == tableView) {
+        ShipingStatusCell *cell = [tableView dequeueReusableCellWithIdentifier:SHIP_CELL_IDENTIFIER forIndexPath:indexPath];
+        
+        NSDictionary *item = [self.shipArray objectAtIndex:indexPath.section];
+        
+        NSString *title = [item objectForKey:@"title"];
+        NSString *icon = [item objectForKey:@"icon"];
+        NSString *desc = [item objectForKey:@"description"];
+        NSString *detail = [item objectForKey:@"detail"];
+        NSString *date = [item objectForKey:@"date"];
+        NSString *port = [item objectForKey:@"port"];
+        NSInteger stage = [[item objectForKey:@"transport_stage"] integerValue];
+        
+        [[[[[[[cell setTitle:title] setDescription:desc] setDetail:detail] setPort:port] setTime:date] setIcon:icon] setTransportStage:stage];
+        
+        return cell;
+    } else {
+        
+        KPITableCell *kpiCell = [tableView dequeueReusableCellWithIdentifier:KPI_CELL_IDENTIFIER forIndexPath:indexPath];
+        kpiCell.KPICollectionView.dataSource = self;
+        kpiCell.KPICollectionView.delegate = self;
+        [kpiCell.KPICollectionView reloadData];
+        if (self.KPIArray.count) {
+            [kpiCell.KPICollectionView setContentOffset:CGPointMake(self.currentKPI * kpiCell.KPICollectionView.bounds.size.width, 0) animated:NO];
+        }
+        return kpiCell;
+    }
     
-    return cell;
 }
 
 //- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
@@ -347,6 +422,9 @@
 //}
 
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
+    if (self.shipTableView != tableView) {
+        return 0.f;
+    }
     return 10;
 }
 
@@ -355,11 +433,18 @@
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
+    if (self.shipTableView != tableView) {
+        return tableView.bounds.size.height;
+    }
     return 110;
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     
+    if (self.shipTableView != tableView) {
+        return;
+    }
+    
     NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
 
 //    [params setObject:@"dumb" forKey:@"id"];
@@ -418,7 +503,7 @@
 
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
     
-    KPICell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:KPI_CELL_IDENTIFIER forIndexPath:indexPath];
+    KPICell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KPICell" forIndexPath:indexPath];
     NSMutableDictionary *item = [[self.KPIArray objectAtIndex:indexPath.item] mutableCopy];
     [item setObject:self.monthArray forKey:@"month"];
     [cell setInfoDic:item];
@@ -433,48 +518,45 @@
 }
 
 - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
-    return 5.0f;
+    return 0.0f;
 }
 
 - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
-    return 5.0f;
+    return 0.0f;
 }
 
 #pragma mark - ScrollViewDelegate
 
 - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
-//    if (scrollView == self.KPICollectionView) {
-//        CGFloat w = scrollView.bounds.size.width;
-//        CGFloat offsetX = scrollView.contentOffset.x;
-//        if (offsetX < w && offsetX >= 0) {
-//            [self.KPICollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.KPIArray.count - 2 inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
-//        } else if (offsetX < (self.KPIArray.count * w) && offsetX >= ((self.KPIArray.count - 1) * w)) {
-//            [self.KPICollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
-//        }
-//
-//    }
-}
-
-#pragma mark - KPIDelegate
-
-- (void)KPIWillShowPreItem {
-    NSInteger index = [[self.KPICollectionView indexPathsForVisibleItems] firstObject].item;
-    if (index == 0) {
-        index = self.KPIArray.count - 1;
-    } else {
-        index--;
+    if (scrollView != self.shipTableView && [scrollView isKindOfClass:[UICollectionView class]]) {
+        UICollectionView *collectionView = (UICollectionView *)scrollView;
+        CGFloat w = scrollView.bounds.size.width;
+        CGFloat offsetX = scrollView.contentOffset.x;
+        if (offsetX < w && offsetX >= 0) {
+            [collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.KPIArray.count - 2 inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
+        } else if (offsetX < (self.KPIArray.count * w) && offsetX >= ((self.KPIArray.count - 1) * w)) {
+            [collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
+        }
     }
-    [self.KPICollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
 }
 
-- (void)KPIWillShowNextItem {
-    NSInteger index = [[self.KPICollectionView indexPathsForVisibleItems] firstObject].item;
-    if (index == self.KPIArray.count - 1) {
-        index = 0;
-    } else {
-        index++;
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
+    if (scrollView != self.shipTableView && [scrollView isKindOfClass:[UICollectionView class]]) {
+//        UICollectionView *collectionView = (UICollectionView *)scrollView;
+        CGFloat w = scrollView.bounds.size.width;
+        CGFloat offsetX = scrollView.contentOffset.x;
+        float f = floorf(offsetX / w);
+        NSInteger index = floorf(f + 0.5);
+        if (index == 0) {
+            index = self.KPIArray.count - 2;
+        }
+        if (index == self.KPIArray.count - 1) {
+            index = 1;
+        }
+        self.currentKPI = index;
+        NSString *str = [NSString stringWithFormat:@"%ld / %ld",index,self.KPIArray.count - 2];
+        self.parentViewController.title = str;
     }
-    [self.KPICollectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:index inSection:0] atScrollPosition:UICollectionViewScrollPositionNone animated:NO];
 }
 
 @end

+ 1 - 3
Apex Mobile/Apex Mobile/KPICell.h

@@ -10,10 +10,8 @@
 
 @protocol KPIDelegate <NSObject>
 
-@required
 
-- (void)KPIWillShowPreItem;
-- (void)KPIWillShowNextItem;
+
 
 @end
 

+ 165 - 60
Apex Mobile/Apex Mobile/KPICell.m

@@ -10,16 +10,17 @@
 #import "XYPieChartView.h"
 #import "KPIButton.h"
 #import "XYCommon.h"
+#import "KPILegendCell.h"
 
 #define TAG_INDEX 1024
 
-@interface KPICell () <PieChartDelegate>
+@interface KPICell () <PieChartDelegate,UITableViewDataSource,UITableViewDelegate>
 
 @property (strong, nonatomic) IBOutlet UILabel *shipmentLB;
 @property (strong, nonatomic) IBOutlet UILabel *containerLB;
 @property (strong, nonatomic) IBOutlet UILabel *teuLB;
 @property (strong, nonatomic) IBOutlet UILabel *TitleLB;
-
+@property (nonatomic,strong) IBOutlet UITableView *legendTableView;
 @property (strong, nonatomic) IBOutlet UILabel *selectedInfoLB;
 @property (strong, nonatomic) IBOutlet XYPieChartView *KPIView;
 @property (strong, nonatomic) IBOutlet UIView *itemsContainer;
@@ -106,31 +107,33 @@
     
 //    NSString *name = [self.infoDic objectForKey:@"name"];
 //    self.TitleLB.text = name;
+//
+//    NSInteger colCount = 2;
+//    CGFloat vInterval = 5.0f, hInterval = 5.0f;
+//    CGFloat w = (CGRectGetWidth(self.bounds) - hInterval * (colCount + 1)) / colCount;
+//    CGFloat h = 20.0f;
+//
+//    NSDictionary *json = _infoDic;
+//    NSArray * itemsArr = json[@"arr_val"];
+//
+//    // 向底部对其
+//    NSInteger rowCount = itemsArr.count / colCount;
+//    NSInteger mod = itemsArr.count % colCount;
+//    if (mod > 0) {
+//        rowCount++;
+//    }
+//    CGFloat ItemAreaH = (h + vInterval) * rowCount;
+//    CGFloat offsetY = (CGRectGetHeight(self.itemsContainer.bounds) - ItemAreaH) * 0.5;
+//    for(int i = 0; i < itemsArr.count; i++) {
+//
+//        NSMutableDictionary* item = [itemsArr objectAtIndex:i];
+//        NSInteger row = i / colCount;
+//        NSInteger col = i % colCount;
+//        CGRect frame = CGRectMake(hInterval + (w + hInterval) * col, offsetY + (h + vInterval) * row, w, h);
+//        [self createKPIButtonWithItem:item Frame:frame Index:i];
+//    }
     
-    NSInteger colCount = 2;
-    CGFloat vInterval = 5.0f, hInterval = 5.0f;
-    CGFloat w = (CGRectGetWidth(self.bounds) - hInterval * (colCount + 1)) / colCount;
-    CGFloat h = 20.0f;
-    
-    NSDictionary *json = _infoDic;
-    NSArray * itemsArr = json[@"arr_val"];
-    
-    // 向底部对其
-    NSInteger rowCount = itemsArr.count / colCount;
-    NSInteger mod = itemsArr.count % colCount;
-    if (mod > 0) {
-        rowCount++;
-    }
-    CGFloat ItemAreaH = (h + vInterval) * rowCount;
-    CGFloat offsetY = (CGRectGetHeight(self.itemsContainer.bounds) - ItemAreaH) * 0.5;
-    for(int i = 0; i < itemsArr.count; i++) {
-        
-        NSMutableDictionary* item = [itemsArr objectAtIndex:i];
-        NSInteger row = i / colCount;
-        NSInteger col = i % colCount;
-        CGRect frame = CGRectMake(hInterval + (w + hInterval) * col, offsetY + (h + vInterval) * row, w, h);
-        [self createKPIButtonWithItem:item Frame:frame Index:i];
-    }
+    [self.legendTableView reloadData];
     
     // 刷新加载
     [self.KPIView reloadChart];
@@ -188,6 +191,7 @@
     
 
     self.KPIView.delegate = self;
+    [self.legendTableView registerNib:[UINib nibWithNibName:@"KPILegendCell" bundle:nil] forCellReuseIdentifier:@"KPILegndCell"];
     
     self.shipmentLB.text = nil;
     self.containerLB.text = nil;
@@ -207,34 +211,34 @@
 - (void)layoutSubviews {
     [super layoutSubviews];
     
-    // 从Storyboard加载后,获取的Frame不正确。
-    NSArray *subViews = self.itemsContainer.subviews;
-    if (subViews.count > 0) {
-        
-        NSInteger colCount = 2;
-        CGFloat vInterval = 5.0f, hInterval = 5.0f;
-        CGFloat w = (CGRectGetWidth(self.bounds) - hInterval * (colCount + 1)) / colCount;
-        CGFloat h = 20.0f;
-        
-        // 居中对其
-        NSInteger rowCount = subViews.count / colCount;
-        NSInteger mod = subViews.count % colCount;
-        if (mod > 0) {
-            rowCount++;
-        }
-        CGFloat ItemAreaH = (h + vInterval) * rowCount;
-        CGFloat offsetY = (CGRectGetHeight(self.itemsContainer.bounds) - ItemAreaH) * 0.5;
-
-        for (int i = 0; i < subViews.count; i++) {
-            UIButton *btn = [(UIButton *)self.itemsContainer viewWithTag:TAG_INDEX + i];
-            NSInteger row = i / colCount;
-            NSInteger col = i % colCount;
-            CGRect frame = CGRectMake(hInterval + (w + hInterval) * col, offsetY + (h + vInterval) * row, w, h);
-            btn.frame = frame;
-        }
-        
-        
-    }
+//    // 从Storyboard加载后,获取的Frame不正确。
+//    NSArray *subViews = self.itemsContainer.subviews;
+//    if (subViews.count > 0) {
+//
+//        NSInteger colCount = 2;
+//        CGFloat vInterval = 5.0f, hInterval = 5.0f;
+//        CGFloat w = (CGRectGetWidth(self.bounds) - hInterval * (colCount + 1)) / colCount;
+//        CGFloat h = 20.0f;
+//
+//        // 居中对其
+//        NSInteger rowCount = subViews.count / colCount;
+//        NSInteger mod = subViews.count % colCount;
+//        if (mod > 0) {
+//            rowCount++;
+//        }
+//        CGFloat ItemAreaH = (h + vInterval) * rowCount;
+//        CGFloat offsetY = (CGRectGetHeight(self.itemsContainer.bounds) - ItemAreaH) * 0.5;
+//
+//        for (int i = 0; i < subViews.count; i++) {
+//            UIButton *btn = [(UIButton *)self.itemsContainer viewWithTag:TAG_INDEX + i];
+//            NSInteger row = i / colCount;
+//            NSInteger col = i % colCount;
+//            CGRect frame = CGRectMake(hInterval + (w + hInterval) * col, offsetY + (h + vInterval) * row, w, h);
+//            btn.frame = frame;
+//        }
+//
+//
+//    }
 }
 
 - (void)didMoveToSuperview {
@@ -248,15 +252,13 @@
 #pragma mark - Action
 
 - (IBAction)preItemBtnClick:(UIButton *)sender {
-    if (self.delegate) {
-        [self.delegate KPIWillShowPreItem];
-    }
+
+    
 }
 
 - (IBAction)nextItemBtnClick:(UIButton *)sender {
-    if (self.delegate) {
-        [self.delegate KPIWillShowNextItem];
-    }
+
+    
 }
 
 #pragma mark - <选中扇形回调>
@@ -336,4 +338,107 @@
     //    return resultImage;
 }
 
+#pragma mark - TableView DataSource & Delegate
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    
+    if (_infoDic == nil) {
+        return 0;
+    }
+    NSArray * itemsArr = _infoDic[@"arr_val"];
+    if (itemsArr == nil) {
+        return 0;
+    }
+    
+    NSInteger row = itemsArr.count / 2;
+    NSInteger col = itemsArr.count % 2;
+    if (col != 0) {
+        row++;
+    }
+    
+    return row;
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    KPILegendCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KPILegndCell" forIndexPath:indexPath];
+    [cell.btn_0 removeTarget:self action:@selector(labelClicked:) forControlEvents:UIControlEventTouchUpInside];
+    [cell.btn_1 removeTarget:self action:@selector(labelClicked:) forControlEvents:UIControlEventTouchUpInside];
+    
+    NSArray * itemsArr = _infoDic[@"arr_val"];
+    
+    NSInteger i = indexPath.row * 2 + 0;
+    [self configureLegendButton:cell.btn_0 withIndex:i];
+    
+    if (i < itemsArr.count - 1) {
+        [self configureLegendButton:cell.btn_1 withIndex:i + 1];
+    }
+    
+    return cell;
+}
+
+- (void)configureLegendButton:(KPIButton *)btn withIndex:(NSInteger)index {
+    
+    NSDictionary *json = _infoDic;
+    NSArray * itemsArr = json[@"arr_val"];
+    
+    
+    NSMutableDictionary* item = [itemsArr objectAtIndex:index];
+    
+    NSString* scolor =item[@"color"];
+    BOOL display = [[item objectForKey:@"display"] boolValue];
+    
+    if(scolor==nil)
+        scolor=@"";
+    unsigned long fcolor = strtoul([scolor UTF8String],0,16);
+    UIImage* colordot = [self createImageWithColor:UIColorFromRGB(fcolor)];
+    UIImage *selectedDot = [self createImageWithColor:[UIColor lightGrayColor]];
+    float percent =[item[@"CP_val"] floatValue];
+    
+    [btn setImage:colordot forState:UIControlStateSelected];
+    [btn setImage:selectedDot forState:UIControlStateNormal];
+    
+    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
+    [btn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
+    
+    [btn setTitle:[NSString stringWithFormat:@"%@(%.2f%%)",item[@"title"],percent] forState:UIControlStateSelected];
+    [btn setTitle:[NSString stringWithFormat:@"%@",item[@"title"]] forState:UIControlStateNormal];
+    
+    btn.titleLabel.font = [UIFont systemFontOfSize:14];
+    btn.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
+    btn.selected = display;
+    btn.tag = TAG_INDEX + index;
+    [btn addTarget:self action:@selector(labelClicked:) forControlEvents:UIControlEventTouchUpInside];
+}
+
+#pragma mark - Touch
+
+- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
+    UIView *view = [super hitTest:point withEvent:event];
+    
+//    NSLog(@"Chart Touch: %@ %@ %@",view.class,view.superview.class,[NSValue valueWithCGPoint:point]);
+    if (view && view.superview && [view.superview isKindOfClass:NSClassFromString(@"XYPieChartView")]) {
+        
+        point = [self convertPoint:point toView:view.superview];
+        CGRect frame = view.superview.bounds;
+        CGFloat radius = MIN(frame.size.width/2, frame.size.height/2);
+        CGPoint center = CGPointMake(frame.size.width/2, frame.size.height/2);
+        CGFloat distance = sqrt(pow(center.x - point.x, 2) + pow(center.y - point.y, 2));
+        if (distance > radius) {
+            ((UICollectionView *)self.superview).scrollEnabled = YES;
+            ((UITableView *)self.superview.superview.superview.superview).scrollEnabled = YES;
+        } else {
+            ((UICollectionView *)self.superview).scrollEnabled = NO;
+            ((UITableView *)self.superview.superview.superview.superview).scrollEnabled = NO;
+        }
+    } else {
+        ((UICollectionView *)self.superview).scrollEnabled = YES;
+        ((UITableView *)self.superview.superview.superview.superview).scrollEnabled = YES;
+    }
+    
+    NSLog(@"Touch Scroll %@",@(((UICollectionView *)self.superview).scrollEnabled));
+    
+    return view;
+}
+
 @end

+ 148 - 0
Apex Mobile/Apex Mobile/KPICell.xib

@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
+        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="KPICell" id="wNu-As-NAS" customClass="KPICell">
+            <rect key="frame" x="0.0" y="0.0" width="374" height="527"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
+                <rect key="frame" x="0.0" y="0.0" width="374" height="527"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Shipment:5868" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4Fk-cU-CCF">
+                        <rect key="frame" x="5" y="43" width="113" height="19.5"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="19.5" id="yzH-do-7ak"/>
+                        </constraints>
+                        <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                        <nil key="textColor"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TEU:16436" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Pvj-cB-Lb5">
+                        <rect key="frame" x="242" y="43" width="82" height="19.5"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                        <nil key="textColor"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cNx-fI-aaf">
+                        <rect key="frame" x="0.0" y="349" width="374" height="178"/>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    </view>
+                    <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="yQd-oN-lqq">
+                        <rect key="frame" x="0.0" y="349" width="374" height="178"/>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <connections>
+                            <outlet property="dataSource" destination="wNu-As-NAS" id="jtv-rl-tVh"/>
+                            <outlet property="delegate" destination="wNu-As-NAS" id="PBy-MB-671"/>
+                        </connections>
+                    </tableView>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This Month" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dQH-Y6-C7B">
+                        <rect key="frame" x="5" y="20" width="86" height="21"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                        <nil key="textColor"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Container:9035" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nC2-JE-lDf">
+                        <rect key="frame" x="123" y="43" width="114" height="19.5"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                        <nil key="textColor"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="48.5%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lb6-Vw-PFH">
+                        <rect key="frame" x="164" y="70" width="46" height="20"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="20" id="0kq-Rc-LsE"/>
+                        </constraints>
+                        <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                        <nil key="textColor"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qDo-7x-vmB" customClass="XYPieChartView">
+                        <rect key="frame" x="62" y="94" width="250" height="250"/>
+                        <color key="backgroundColor" red="0.31186315860000002" green="0.73688559149999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="250" id="QY9-hk-FEV"/>
+                            <constraint firstAttribute="width" secondItem="qDo-7x-vmB" secondAttribute="height" multiplier="1:1" id="sG3-FX-7mN"/>
+                        </constraints>
+                    </view>
+                    <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aQn-Wp-hiD">
+                        <rect key="frame" x="5" y="94" width="30" height="250"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="30" id="lIr-oJ-0hV"/>
+                        </constraints>
+                        <state key="normal" image="preItem"/>
+                        <connections>
+                            <action selector="preItemBtnClick:" destination="wNu-As-NAS" eventType="touchUpInside" id="KKC-2B-Ezw"/>
+                        </connections>
+                    </button>
+                    <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="d9V-2s-nfa">
+                        <rect key="frame" x="339" y="94" width="30" height="250"/>
+                        <state key="normal" image="nextItem"/>
+                        <connections>
+                            <action selector="nextItemBtnClick:" destination="wNu-As-NAS" eventType="touchUpInside" id="mav-9J-hFm"/>
+                        </connections>
+                    </button>
+                </subviews>
+            </view>
+            <constraints>
+                <constraint firstItem="dQH-Y6-C7B" firstAttribute="leading" secondItem="wNu-As-NAS" secondAttribute="leading" constant="5" id="2lM-L4-c8U"/>
+                <constraint firstItem="qDo-7x-vmB" firstAttribute="centerX" secondItem="wNu-As-NAS" secondAttribute="centerX" id="4Iw-M0-rdd"/>
+                <constraint firstItem="aQn-Wp-hiD" firstAttribute="bottom" secondItem="qDo-7x-vmB" secondAttribute="bottom" id="5dl-lV-vzu"/>
+                <constraint firstItem="nC2-JE-lDf" firstAttribute="leading" secondItem="4Fk-cU-CCF" secondAttribute="trailing" constant="5" id="6af-st-ahT"/>
+                <constraint firstItem="yQd-oN-lqq" firstAttribute="height" secondItem="cNx-fI-aaf" secondAttribute="height" id="84C-Bq-ok8"/>
+                <constraint firstItem="dQH-Y6-C7B" firstAttribute="top" secondItem="wNu-As-NAS" secondAttribute="topMargin" id="8pi-uR-5CQ"/>
+                <constraint firstItem="4Fk-cU-CCF" firstAttribute="leading" secondItem="wNu-As-NAS" secondAttribute="leading" constant="5" id="9dU-t8-HTB"/>
+                <constraint firstItem="aQn-Wp-hiD" firstAttribute="top" secondItem="qDo-7x-vmB" secondAttribute="top" id="DEB-sW-vRd"/>
+                <constraint firstItem="d9V-2s-nfa" firstAttribute="top" secondItem="qDo-7x-vmB" secondAttribute="top" id="Egk-uA-8J6"/>
+                <constraint firstItem="d9V-2s-nfa" firstAttribute="width" secondItem="aQn-Wp-hiD" secondAttribute="width" id="F0L-mr-btU"/>
+                <constraint firstItem="aQn-Wp-hiD" firstAttribute="leading" secondItem="wNu-As-NAS" secondAttribute="leading" constant="5" id="J09-K9-9jr"/>
+                <constraint firstItem="cNx-fI-aaf" firstAttribute="top" secondItem="qDo-7x-vmB" secondAttribute="bottom" constant="5" id="NJr-5v-JEP"/>
+                <constraint firstItem="Pvj-cB-Lb5" firstAttribute="height" secondItem="nC2-JE-lDf" secondAttribute="height" id="OXa-7y-Oej"/>
+                <constraint firstItem="qDo-7x-vmB" firstAttribute="top" secondItem="lb6-Vw-PFH" secondAttribute="bottom" constant="4" id="OYy-4x-NCk"/>
+                <constraint firstItem="Pvj-cB-Lb5" firstAttribute="centerY" secondItem="nC2-JE-lDf" secondAttribute="centerY" id="OdC-Z4-u8a"/>
+                <constraint firstItem="d9V-2s-nfa" firstAttribute="bottom" secondItem="qDo-7x-vmB" secondAttribute="bottom" id="RlI-BI-dxq"/>
+                <constraint firstItem="yQd-oN-lqq" firstAttribute="centerX" secondItem="cNx-fI-aaf" secondAttribute="centerX" id="V3A-Mm-ru4"/>
+                <constraint firstAttribute="bottom" secondItem="cNx-fI-aaf" secondAttribute="bottom" id="WmE-Ea-0kU"/>
+                <constraint firstAttribute="trailing" secondItem="cNx-fI-aaf" secondAttribute="trailing" id="YjQ-Ms-wKn"/>
+                <constraint firstItem="Pvj-cB-Lb5" firstAttribute="leading" secondItem="nC2-JE-lDf" secondAttribute="trailing" constant="5" id="a1H-GC-9hb"/>
+                <constraint firstItem="lb6-Vw-PFH" firstAttribute="centerX" secondItem="wNu-As-NAS" secondAttribute="centerX" id="dtn-yK-zJm"/>
+                <constraint firstItem="cNx-fI-aaf" firstAttribute="leading" secondItem="wNu-As-NAS" secondAttribute="leading" id="eTH-C6-hao"/>
+                <constraint firstItem="yQd-oN-lqq" firstAttribute="centerY" secondItem="cNx-fI-aaf" secondAttribute="centerY" id="iVg-L7-aqI"/>
+                <constraint firstItem="nC2-JE-lDf" firstAttribute="centerY" secondItem="4Fk-cU-CCF" secondAttribute="centerY" id="moa-zY-KpX"/>
+                <constraint firstAttribute="trailing" secondItem="d9V-2s-nfa" secondAttribute="trailing" constant="5" id="ode-Wt-TvI"/>
+                <constraint firstItem="nC2-JE-lDf" firstAttribute="height" secondItem="4Fk-cU-CCF" secondAttribute="height" id="sHI-Ns-FoD"/>
+                <constraint firstItem="yQd-oN-lqq" firstAttribute="width" secondItem="cNx-fI-aaf" secondAttribute="width" id="vfh-Wu-8vY"/>
+                <constraint firstItem="4Fk-cU-CCF" firstAttribute="top" secondItem="dQH-Y6-C7B" secondAttribute="bottom" constant="2" id="x7Q-iv-ien"/>
+                <constraint firstItem="lb6-Vw-PFH" firstAttribute="top" secondItem="Pvj-cB-Lb5" secondAttribute="bottom" constant="7" id="xJA-6K-7Zf"/>
+                <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Pvj-cB-Lb5" secondAttribute="trailing" id="ymO-Lu-kKX"/>
+            </constraints>
+            <viewLayoutGuide key="safeArea" id="nQV-nV-Ix9"/>
+            <connections>
+                <outlet property="KPIHeightConstraint" destination="QY9-hk-FEV" id="5Mz-I9-rHy"/>
+                <outlet property="KPIView" destination="qDo-7x-vmB" id="Cym-HS-chX"/>
+                <outlet property="containerLB" destination="nC2-JE-lDf" id="X6M-fM-TmY"/>
+                <outlet property="itemsContainer" destination="cNx-fI-aaf" id="nab-eG-q3s"/>
+                <outlet property="legendTableView" destination="yQd-oN-lqq" id="Cfr-U4-Np3"/>
+                <outlet property="selectedInfoLB" destination="lb6-Vw-PFH" id="gFb-qi-TMp"/>
+                <outlet property="shipmentLB" destination="4Fk-cU-CCF" id="tbD-oe-kgp"/>
+                <outlet property="teuLB" destination="Pvj-cB-Lb5" id="qIS-0N-u5b"/>
+            </connections>
+        </collectionViewCell>
+    </objects>
+    <resources>
+        <image name="nextItem" width="30" height="100"/>
+        <image name="preItem" width="30" height="100"/>
+    </resources>
+</document>

+ 17 - 0
Apex Mobile/Apex Mobile/KPILegendCell.h

@@ -0,0 +1,17 @@
+//
+//  KPILegendCell.h
+//  Apex Mobile
+//
+//  Created by Jack on 2018/4/16.
+//  Copyright © 2018年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class KPIButton;
+@interface KPILegendCell : UITableViewCell
+
+@property (nonatomic,strong) IBOutlet KPIButton *btn_0;
+@property (nonatomic,strong) IBOutlet KPIButton *btn_1;
+
+@end

+ 39 - 0
Apex Mobile/Apex Mobile/KPILegendCell.m

@@ -0,0 +1,39 @@
+//
+//  KPILegendCell.m
+//  Apex Mobile
+//
+//  Created by Jack on 2018/4/16.
+//  Copyright © 2018年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "KPILegendCell.h"
+#import "KPIButton.h"
+
+@interface KPILegendCell ()
+
+
+
+@end
+
+@implementation KPILegendCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+- (IBAction)btn_1_click:(id)sender {
+    
+}
+
+- (IBAction)btn_0_click:(id)sender {
+    
+}
+
+@end

+ 49 - 0
Apex Mobile/Apex Mobile/KPILegendCell.xib

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="KPILegndCell" id="42d-ZC-jas" customClass="KPILegendCell">
+            <rect key="frame" x="0.0" y="0.0" width="374" height="44"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="42d-ZC-jas" id="LG3-Gd-WdO">
+                <rect key="frame" x="0.0" y="0.0" width="374" height="43.5"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Sun-HC-YBP" customClass="KPIButton">
+                        <rect key="frame" x="5" y="5" width="179.5" height="34"/>
+                        <connections>
+                            <action selector="btn_0_click:" destination="42d-ZC-jas" eventType="touchUpInside" id="DND-7D-2Ib"/>
+                        </connections>
+                    </button>
+                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BFw-JA-akt" customClass="KPIButton">
+                        <rect key="frame" x="189.5" y="5" width="179.5" height="34"/>
+                        <connections>
+                            <action selector="btn_1_click:" destination="42d-ZC-jas" eventType="touchUpInside" id="xqg-fo-k7M"/>
+                        </connections>
+                    </button>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="Sun-HC-YBP" firstAttribute="centerY" secondItem="LG3-Gd-WdO" secondAttribute="centerY" id="2w8-R2-58j"/>
+                    <constraint firstItem="BFw-JA-akt" firstAttribute="centerY" secondItem="LG3-Gd-WdO" secondAttribute="centerY" id="3JH-bS-V3s"/>
+                    <constraint firstAttribute="trailing" secondItem="BFw-JA-akt" secondAttribute="trailing" constant="5" id="5df-RT-mDc"/>
+                    <constraint firstItem="BFw-JA-akt" firstAttribute="leading" secondItem="Sun-HC-YBP" secondAttribute="trailing" constant="5" id="GPK-3B-Bhg"/>
+                    <constraint firstItem="Sun-HC-YBP" firstAttribute="leading" secondItem="LG3-Gd-WdO" secondAttribute="leading" constant="5" id="KRt-w8-Orj"/>
+                    <constraint firstItem="BFw-JA-akt" firstAttribute="width" secondItem="Sun-HC-YBP" secondAttribute="width" id="WE4-rB-v7C"/>
+                </constraints>
+            </tableViewCellContentView>
+            <connections>
+                <outlet property="btn_0" destination="Sun-HC-YBP" id="jzp-Z3-wf1"/>
+                <outlet property="btn_1" destination="BFw-JA-akt" id="6ty-Km-OJm"/>
+            </connections>
+        </tableViewCell>
+    </objects>
+</document>

+ 15 - 0
Apex Mobile/Apex Mobile/KPITableCell.h

@@ -0,0 +1,15 @@
+//
+//  KPITableCell.h
+//  Apex Mobile
+//
+//  Created by Jack on 2018/4/16.
+//  Copyright © 2018年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface KPITableCell : UITableViewCell
+
+@property (nonatomic,strong) IBOutlet UICollectionView *KPICollectionView;
+
+@end

+ 31 - 0
Apex Mobile/Apex Mobile/KPITableCell.m

@@ -0,0 +1,31 @@
+//
+//  KPITableCell.m
+//  Apex Mobile
+//
+//  Created by Jack on 2018/4/16.
+//  Copyright © 2018年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "KPITableCell.h"
+
+@interface KPITableCell ()
+
+
+
+@end
+
+@implementation KPITableCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+    [self.KPICollectionView registerNib:[UINib nibWithNibName:@"KPICell" bundle:nil] forCellWithReuseIdentifier:@"KPICell"];
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

+ 48 - 0
Apex Mobile/Apex Mobile/KPITableCell.xib

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="KPITableCell" id="KGk-i7-Jjw" customClass="KPITableCell">
+            <rect key="frame" x="0.0" y="0.0" width="357" height="667"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
+                <rect key="frame" x="0.0" y="0.0" width="357" height="666.5"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="psG-H8-BSH">
+                        <rect key="frame" x="0.0" y="0.0" width="357" height="666"/>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="10" id="vzv-2G-b0G">
+                            <size key="itemSize" width="374" height="527"/>
+                            <size key="headerReferenceSize" width="0.0" height="0.0"/>
+                            <size key="footerReferenceSize" width="0.0" height="0.0"/>
+                            <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
+                        </collectionViewFlowLayout>
+                        <cells/>
+                    </collectionView>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="psG-H8-BSH" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="CpN-In-Yog"/>
+                    <constraint firstItem="psG-H8-BSH" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="ESf-6W-MeF"/>
+                    <constraint firstAttribute="bottom" secondItem="psG-H8-BSH" secondAttribute="bottom" id="NFE-0r-tXZ"/>
+                    <constraint firstAttribute="trailing" secondItem="psG-H8-BSH" secondAttribute="trailing" id="hzd-JT-TVs"/>
+                </constraints>
+            </tableViewCellContentView>
+            <viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
+            <connections>
+                <outlet property="KPICollectionView" destination="psG-H8-BSH" id="vqA-VA-p5W"/>
+            </connections>
+            <point key="canvasLocation" x="-245" y="41"/>
+        </tableViewCell>
+    </objects>
+</document>

+ 10 - 162
Apex Mobile/Apex Mobile/Main.storyboard

@@ -6,8 +6,6 @@
     <dependencies>
         <deployment version="2304" identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
-        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
-        <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -288,134 +286,14 @@
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" pagingEnabled="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="BMV-js-RbK">
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="5aj-tl-FN7">
                                 <rect key="frame" x="0.0" y="94" width="375" height="524"/>
-                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="10" id="bgx-ah-Ujy">
-                                    <size key="itemSize" width="374" height="527"/>
-                                    <size key="headerReferenceSize" width="0.0" height="0.0"/>
-                                    <size key="footerReferenceSize" width="0.0" height="0.0"/>
-                                    <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
-                                </collectionViewFlowLayout>
-                                <cells>
-                                    <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="KPICell" id="hOk-Q6-U2Y" customClass="KPICell">
-                                        <rect key="frame" x="0.0" y="-1.5" width="374" height="527"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                        <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
-                                            <rect key="frame" x="0.0" y="0.0" width="374" height="527"/>
-                                            <autoresizingMask key="autoresizingMask"/>
-                                            <subviews>
-                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Shipment:5868" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HR2-MW-QBD">
-                                                    <rect key="frame" x="5" y="31" width="113" height="19.5"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="19.5" id="hDC-6j-Te0"/>
-                                                    </constraints>
-                                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
-                                                    <nil key="textColor"/>
-                                                    <nil key="highlightedColor"/>
-                                                </label>
-                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TEU:16436" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SiU-f3-vg5">
-                                                    <rect key="frame" x="242" y="31" width="82" height="19.5"/>
-                                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
-                                                    <nil key="textColor"/>
-                                                    <nil key="highlightedColor"/>
-                                                </label>
-                                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fzk-UY-Jay">
-                                                    <rect key="frame" x="0.0" y="337" width="374" height="190"/>
-                                                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                                </view>
-                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This Month" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TdU-EN-0bl">
-                                                    <rect key="frame" x="5" y="8" width="86" height="21"/>
-                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
-                                                    <nil key="textColor"/>
-                                                    <nil key="highlightedColor"/>
-                                                </label>
-                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Container:9035" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5BU-lo-4qt">
-                                                    <rect key="frame" x="123" y="31" width="114" height="19.5"/>
-                                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
-                                                    <nil key="textColor"/>
-                                                    <nil key="highlightedColor"/>
-                                                </label>
-                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="48.5%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nqS-Pj-374">
-                                                    <rect key="frame" x="164" y="58" width="46" height="20"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="20" id="Jme-st-oMg"/>
-                                                    </constraints>
-                                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
-                                                    <nil key="textColor"/>
-                                                    <nil key="highlightedColor"/>
-                                                </label>
-                                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aTr-Mi-Mg3" customClass="XYPieChartView">
-                                                    <rect key="frame" x="62" y="82" width="250" height="250"/>
-                                                    <color key="backgroundColor" red="0.31186315860000002" green="0.73688559149999999" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" secondItem="aTr-Mi-Mg3" secondAttribute="height" multiplier="1:1" id="Huw-mu-fRN"/>
-                                                        <constraint firstAttribute="height" constant="250" id="VQp-Nn-Hkb"/>
-                                                    </constraints>
-                                                </view>
-                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5at-hb-Z6F">
-                                                    <rect key="frame" x="5" y="82" width="30" height="250"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="width" constant="30" id="zSs-uv-rnc"/>
-                                                    </constraints>
-                                                    <state key="normal" image="preItem"/>
-                                                    <connections>
-                                                        <action selector="preItemBtnClick:" destination="hOk-Q6-U2Y" eventType="touchUpInside" id="LlV-0C-94q"/>
-                                                    </connections>
-                                                </button>
-                                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NEW-gP-kfO">
-                                                    <rect key="frame" x="339" y="82" width="30" height="250"/>
-                                                    <state key="normal" image="nextItem"/>
-                                                    <connections>
-                                                        <action selector="nextItemBtnClick:" destination="hOk-Q6-U2Y" eventType="touchUpInside" id="jah-g3-sSG"/>
-                                                    </connections>
-                                                </button>
-                                            </subviews>
-                                        </view>
-                                        <constraints>
-                                            <constraint firstAttribute="bottom" secondItem="Fzk-UY-Jay" secondAttribute="bottom" id="1Y6-qV-4be"/>
-                                            <constraint firstAttribute="trailing" secondItem="Fzk-UY-Jay" secondAttribute="trailing" id="4ue-Uk-9c4"/>
-                                            <constraint firstItem="TdU-EN-0bl" firstAttribute="top" secondItem="hOk-Q6-U2Y" secondAttribute="topMargin" id="8Dy-Pp-5Km"/>
-                                            <constraint firstItem="NEW-gP-kfO" firstAttribute="top" secondItem="aTr-Mi-Mg3" secondAttribute="top" id="9xq-aY-fVG"/>
-                                            <constraint firstItem="HR2-MW-QBD" firstAttribute="top" secondItem="TdU-EN-0bl" secondAttribute="bottom" constant="2" id="E4C-4y-I88"/>
-                                            <constraint firstItem="5at-hb-Z6F" firstAttribute="leading" secondItem="hOk-Q6-U2Y" secondAttribute="leading" constant="5" id="FoZ-9C-sc9"/>
-                                            <constraint firstItem="SiU-f3-vg5" firstAttribute="height" secondItem="5BU-lo-4qt" secondAttribute="height" id="HDa-AP-k8s"/>
-                                            <constraint firstItem="NEW-gP-kfO" firstAttribute="bottom" secondItem="aTr-Mi-Mg3" secondAttribute="bottom" id="IF9-dO-PCB"/>
-                                            <constraint firstItem="nqS-Pj-374" firstAttribute="top" secondItem="SiU-f3-vg5" secondAttribute="bottom" constant="7" id="K1A-lf-3l3"/>
-                                            <constraint firstItem="aTr-Mi-Mg3" firstAttribute="top" secondItem="nqS-Pj-374" secondAttribute="bottom" constant="4" id="MMZ-ga-uX8"/>
-                                            <constraint firstItem="aTr-Mi-Mg3" firstAttribute="centerX" secondItem="hOk-Q6-U2Y" secondAttribute="centerX" id="NJD-sL-lZu"/>
-                                            <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="SiU-f3-vg5" secondAttribute="trailing" id="Oqq-Mo-cDQ"/>
-                                            <constraint firstItem="NEW-gP-kfO" firstAttribute="width" secondItem="5at-hb-Z6F" secondAttribute="width" id="Pt4-h9-f63"/>
-                                            <constraint firstItem="TdU-EN-0bl" firstAttribute="leading" secondItem="hOk-Q6-U2Y" secondAttribute="leading" constant="5" id="RCu-sb-u2d"/>
-                                            <constraint firstItem="5BU-lo-4qt" firstAttribute="centerY" secondItem="HR2-MW-QBD" secondAttribute="centerY" id="aJp-oe-BEb"/>
-                                            <constraint firstItem="HR2-MW-QBD" firstAttribute="leading" secondItem="hOk-Q6-U2Y" secondAttribute="leading" constant="5" id="c5e-3z-YkJ"/>
-                                            <constraint firstItem="SiU-f3-vg5" firstAttribute="centerY" secondItem="5BU-lo-4qt" secondAttribute="centerY" id="cUe-lI-M8w"/>
-                                            <constraint firstItem="5BU-lo-4qt" firstAttribute="height" secondItem="HR2-MW-QBD" secondAttribute="height" id="epV-Od-GWW"/>
-                                            <constraint firstItem="Fzk-UY-Jay" firstAttribute="top" secondItem="aTr-Mi-Mg3" secondAttribute="bottom" constant="5" id="jpV-Oc-1y7"/>
-                                            <constraint firstItem="5at-hb-Z6F" firstAttribute="bottom" secondItem="aTr-Mi-Mg3" secondAttribute="bottom" id="nie-Ua-1Nc"/>
-                                            <constraint firstItem="Fzk-UY-Jay" firstAttribute="leading" secondItem="hOk-Q6-U2Y" secondAttribute="leading" id="qeg-tq-EXd"/>
-                                            <constraint firstItem="5at-hb-Z6F" firstAttribute="top" secondItem="aTr-Mi-Mg3" secondAttribute="top" id="tTr-R5-M9c"/>
-                                            <constraint firstItem="nqS-Pj-374" firstAttribute="centerX" secondItem="hOk-Q6-U2Y" secondAttribute="centerX" id="vxF-gO-wHr"/>
-                                            <constraint firstItem="5BU-lo-4qt" firstAttribute="leading" secondItem="HR2-MW-QBD" secondAttribute="trailing" constant="5" id="xRF-a6-woN"/>
-                                            <constraint firstAttribute="trailing" secondItem="NEW-gP-kfO" secondAttribute="trailing" constant="5" id="yZV-ui-z0C"/>
-                                            <constraint firstItem="SiU-f3-vg5" firstAttribute="leading" secondItem="5BU-lo-4qt" secondAttribute="trailing" constant="5" id="ydy-jS-Fh6"/>
-                                        </constraints>
-                                        <connections>
-                                            <outlet property="KPIHeightConstraint" destination="VQp-Nn-Hkb" id="Mkc-e4-eDe"/>
-                                            <outlet property="KPIView" destination="aTr-Mi-Mg3" id="vVK-Al-vdn"/>
-                                            <outlet property="containerLB" destination="5BU-lo-4qt" id="oEX-rp-eq2"/>
-                                            <outlet property="itemsContainer" destination="Fzk-UY-Jay" id="Ywd-mh-Ztp"/>
-                                            <outlet property="selectedInfoLB" destination="nqS-Pj-374" id="OCq-CG-aYw"/>
-                                            <outlet property="shipmentLB" destination="HR2-MW-QBD" id="Wxb-do-sCz"/>
-                                            <outlet property="teuLB" destination="SiU-f3-vg5" id="9Pn-rA-bkJ"/>
-                                        </connections>
-                                    </collectionViewCell>
-                                </cells>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <connections>
-                                    <outlet property="dataSource" destination="ucJ-C2-JJ8" id="AFv-ml-oCs"/>
-                                    <outlet property="delegate" destination="ucJ-C2-JJ8" id="gT6-zp-Mu8"/>
+                                    <outlet property="dataSource" destination="ucJ-C2-JJ8" id="sHI-R9-c02"/>
+                                    <outlet property="delegate" destination="ucJ-C2-JJ8" id="Svl-Ln-geD"/>
                                 </connections>
-                            </collectionView>
+                            </tableView>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="iIl-j9-7oa">
                                 <rect key="frame" x="0.0" y="94" width="375" height="524"/>
                                 <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
@@ -425,23 +303,6 @@
                                     <outlet property="delegate" destination="ucJ-C2-JJ8" id="qcO-e8-lls"/>
                                 </connections>
                             </tableView>
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RDS-rb-8d8">
-                                <rect key="frame" x="64.5" y="326" width="245" height="60"/>
-                                <constraints>
-                                    <constraint firstAttribute="height" constant="60" id="71k-hL-Hln"/>
-                                    <constraint firstAttribute="width" constant="245" id="I9Y-XO-Wcn"/>
-                                </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="20"/>
-                                <state key="normal" title="No Data">
-                                    <color key="titleColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
-                                </state>
-                                <state key="highlighted">
-                                    <color key="titleColor" red="0.075363273055734453" green="0.4711389054307723" blue="0.99917410537986562" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                </state>
-                                <connections>
-                                    <action selector="emptyBtnClick:" destination="ucJ-C2-JJ8" eventType="touchUpInside" id="hUc-FI-y19"/>
-                                </connections>
-                            </button>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3xo-DP-qWN">
                                 <rect key="frame" x="0.0" y="64" width="375" height="30"/>
                                 <subviews>
@@ -464,38 +325,27 @@
                                     <constraint firstItem="6ie-Rf-Nau" firstAttribute="top" secondItem="3xo-DP-qWN" secondAttribute="top" id="wFw-qc-77U"/>
                                 </constraints>
                             </view>
-                            <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="WyF-Pl-7ix">
-                                <rect key="frame" x="169" y="315" width="37" height="37"/>
-                                <color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
-                                <color key="color" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
-                            </activityIndicatorView>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
-                            <constraint firstItem="WyF-Pl-7ix" firstAttribute="centerX" secondItem="ifC-vl-u6I" secondAttribute="centerX" id="0Dt-hM-q3g"/>
+                            <constraint firstItem="6yV-PD-KCp" firstAttribute="top" secondItem="5aj-tl-FN7" secondAttribute="bottom" id="05a-xR-fo2"/>
+                            <constraint firstItem="5aj-tl-FN7" firstAttribute="top" secondItem="3xo-DP-qWN" secondAttribute="bottom" id="3Af-tB-X67"/>
                             <constraint firstItem="3xo-DP-qWN" firstAttribute="top" secondItem="70L-ql-L3f" secondAttribute="bottom" id="7dN-EO-3Yh"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="trailing" secondItem="ifC-vl-u6I" secondAttribute="trailing" id="9jR-8W-zYM"/>
-                            <constraint firstItem="BMV-js-RbK" firstAttribute="top" secondItem="3xo-DP-qWN" secondAttribute="bottom" id="CCx-SX-Rkz"/>
                             <constraint firstAttribute="trailing" secondItem="3xo-DP-qWN" secondAttribute="trailing" id="Gvc-tU-QdZ"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="top" secondItem="3xo-DP-qWN" secondAttribute="bottom" id="JZI-44-qDk"/>
-                            <constraint firstItem="RDS-rb-8d8" firstAttribute="centerX" secondItem="iIl-j9-7oa" secondAttribute="centerX" id="Ta8-8u-MVg"/>
-                            <constraint firstItem="6yV-PD-KCp" firstAttribute="top" secondItem="BMV-js-RbK" secondAttribute="bottom" id="cln-1K-IE0"/>
-                            <constraint firstItem="BMV-js-RbK" firstAttribute="leading" secondItem="ifC-vl-u6I" secondAttribute="leading" id="d5k-6n-t6t"/>
-                            <constraint firstItem="WyF-Pl-7ix" firstAttribute="centerY" secondItem="ifC-vl-u6I" secondAttribute="centerY" id="ga0-M2-tYJ"/>
-                            <constraint firstAttribute="trailing" secondItem="BMV-js-RbK" secondAttribute="trailing" id="jnX-4Q-CQl"/>
+                            <constraint firstAttribute="trailing" secondItem="5aj-tl-FN7" secondAttribute="trailing" id="Ple-1P-42o"/>
+                            <constraint firstItem="5aj-tl-FN7" firstAttribute="leading" secondItem="ifC-vl-u6I" secondAttribute="leading" id="eLf-n9-JxT"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="leading" secondItem="ifC-vl-u6I" secondAttribute="leading" id="lPc-7m-bBJ"/>
                             <constraint firstItem="3xo-DP-qWN" firstAttribute="leading" secondItem="ifC-vl-u6I" secondAttribute="leading" id="mui-fH-ZHN"/>
                             <constraint firstItem="iIl-j9-7oa" firstAttribute="bottom" secondItem="6yV-PD-KCp" secondAttribute="top" id="nZz-HM-ESm"/>
-                            <constraint firstItem="RDS-rb-8d8" firstAttribute="centerY" secondItem="iIl-j9-7oa" secondAttribute="centerY" id="sSc-MF-J2F"/>
                         </constraints>
                     </view>
                     <tabBarItem key="tabBarItem" title="Home" image="tab_home" id="OC9-MV-8nf"/>
                     <navigationItem key="navigationItem" id="giR-co-TyJ"/>
                     <simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
                     <connections>
-                        <outlet property="KPICollectionView" destination="BMV-js-RbK" id="19x-Mk-965"/>
-                        <outlet property="emptyBtn" destination="RDS-rb-8d8" id="Hvx-vb-hoW"/>
-                        <outlet property="loadIndicator" destination="WyF-Pl-7ix" id="smN-0v-oSv"/>
+                        <outlet property="KPITableView" destination="5aj-tl-FN7" id="aND-mx-T5V"/>
                         <outlet property="segmentControl" destination="6ie-Rf-Nau" id="q6N-98-j6F"/>
                         <outlet property="shipTableView" destination="iIl-j9-7oa" id="vsk-WU-ScI"/>
                     </connections>
@@ -1945,8 +1795,6 @@
         <image name="ic_pdf128" width="48" height="48"/>
         <image name="ic_setting" width="30" height="30"/>
         <image name="map (1)" width="32" height="32"/>
-        <image name="nextItem" width="30" height="100"/>
-        <image name="preItem" width="30" height="100"/>
         <image name="rect_market_news" width="48" height="48"/>
         <image name="tab_history" width="30" height="30"/>
         <image name="tab_home" width="30" height="30"/>

+ 3 - 2
Apex Mobile/Apex Mobile/PieChart/XYPieChartView.h

@@ -19,8 +19,9 @@
 - (void)showDetail:(XYPieChartView *)pieChartView index:(NSInteger)index selectedType:(NSDictionary *)selectedType;
 
 // 点击事件处理
-- (void)pieChartView:(XYPieChartView *)chartView didBeginTouch:(NSSet<UITouch *> *)touch;
-- (void)pieChartView:(XYPieChartView *)chartView didEndTouch:(NSSet<UITouch *> *)touch;
+//- (void)pieChartView:(XYPieChartView *)chartView didBeginTouch:(NSSet<UITouch *> *)touch;
+//- (void)pieChartView:(XYPieChartView *)chartView didEndTouch:(NSSet<UITouch *> *)touch;
+
 
 //// Animation
 //- (void)pieChartAnimationBegin;

+ 11 - 11
Apex Mobile/Apex Mobile/PieChart/XYPieChartView.m

@@ -491,17 +491,17 @@
 
 #pragma mark - Touch
 
-- (void)pieChartView:(XYRotatedView *)chartView didBeginTouch:(NSSet<UITouch *> *)touch {
-    if (self.delegate && [self.delegate respondsToSelector:@selector(pieChartView:didBeginTouch:)]) {
-        [self.delegate pieChartView:self didBeginTouch:touch];
-    }
-}
-
-- (void)pieChartView:(XYRotatedView *)chartView didEndTouch:(NSSet<UITouch *> *)touch {
-    if (self.delegate && [self.delegate respondsToSelector:@selector(pieChartView:didEndTouch:)]) {
-        [self.delegate pieChartView:self didEndTouch:touch];
-    }
-}
+//- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
+//    UIView *view = [super hitTest:point withEvent:event];
+//    
+//    if ([view isKindOfClass:[XYRotatedView class]]) {
+//        
+//    }
+//    
+//    NSLog(@"Chart Touch: %@",NSStringFromClass(view.class));
+//    
+//    return view;
+//}
 
 #pragma mark - Animation
 

+ 7 - 7
Apex Mobile/Apex Mobile/PieChart/XYRenderView.m

@@ -131,7 +131,7 @@ static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAn
         
         _startPieAngle = M_PI_2*2;
         
-        _selectedSliceStroke = 3.0;
+        _selectedSliceStroke = 1.0f;
         
         self.pieRadius = MIN(frame.size.width/2, frame.size.height/2);
         
@@ -141,8 +141,8 @@ static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAn
         
         _labelRadius = _pieRadius/2;
         
-        _selectedSliceOffsetRadius = MAX(10, _pieRadius/10);
-        
+//        _selectedSliceOffsetRadius = MAX(10, _pieRadius/10);
+        _selectedSliceOffsetRadius = 5.0f;
         _showLabel = YES;
         
         _showPercentage = YES;
@@ -170,7 +170,7 @@ static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAn
         
         _animationSpeed = 0.5;
         _startPieAngle = M_PI_2*2;
-        _selectedSliceStroke = 3.0;
+        _selectedSliceStroke = 1.0f;
         
         CGRect bounds = [[self layer] bounds];
         self.pieRadius = MIN(bounds.size.width/2, bounds.size.height/2) - 10;
@@ -451,7 +451,7 @@ static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAn
             [layer setFillColor:color.CGColor];
             if (sliceCount > 1) {
                 [layer setStrokeColor:ColorRGBA(255, 255, 255, 1).CGColor];
-                [layer setLineWidth:3.0];
+                [layer setLineWidth:_selectedSliceStroke];
             }
             
             [self updateLabelForLayer:layer value:values[index]];
@@ -632,7 +632,7 @@ static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAn
         [pieLayer setZPosition:kDefaultSliceZOrder];
         [self createSliceLayer];
         if (pieLayers.count > 1) {
-            [pieLayer setLineWidth:3.0];
+            [pieLayer setLineWidth:_selectedSliceStroke];
         }
     }
     
@@ -738,7 +738,7 @@ static CGPathRef CGPathCreateArc(CGPoint center, CGFloat radius, CGFloat startAn
     
     // 当百分比过小时,划线显示百分比
     CAShapeLayer *lineLayer = [CAShapeLayer layer];
-    lineLayer.lineWidth = 1;
+    lineLayer.lineWidth = _selectedSliceStroke;
     lineLayer.strokeColor = [UIColor grayColor].CGColor;
     
     [CATransaction setDisableActions:NO];

+ 0 - 3
Apex Mobile/Apex Mobile/PieChart/XYRotatedView.h

@@ -18,9 +18,6 @@
 - (void)showDetail:(XYRotatedView *)rotatedView index:(NSInteger)index ;
 
 @required
-// 点击事件处理
-- (void)pieChartView:(XYRotatedView *)chartView didBeginTouch:(NSSet<UITouch *> *)touch;
-- (void)pieChartView:(XYRotatedView *)chartView didEndTouch:(NSSet<UITouch *> *)touch;
 
 // Animation
 - (void)pieChartAnimationBegin;

+ 0 - 10
Apex Mobile/Apex Mobile/PieChart/XYRotatedView.m

@@ -310,10 +310,6 @@
 #pragma mark Responder
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
     
-    if (self.delegate && [self.delegate respondsToSelector:@selector(pieChartView:didBeginTouch:)]) {
-        [self.delegate pieChartView:self didBeginTouch:touches];
-    }
-    
     NSLog(@"rotated view touch began");
     if (_isAutoRotation) {
         return;
@@ -365,9 +361,6 @@
 
 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
     
-    if (self.delegate && [self.delegate respondsToSelector:@selector(pieChartView:didEndTouch:)]) {
-        [self.delegate pieChartView:self didEndTouch:touches];
-    }
     
     self.touch_index = -1;
     if (_isAutoRotation) {
@@ -390,9 +383,6 @@
 
 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
     
-    if (self.delegate && [self.delegate respondsToSelector:@selector(pieChartView:didEndTouch:)]) {
-        [self.delegate pieChartView:self didEndTouch:touches];
-    }
 }
 
 #pragma -mark xypieSource

+ 1 - 0
Apex Mobile/Apex Mobile/RANetwork.h

@@ -41,4 +41,5 @@
 + (NSDictionary *)search:(NSMutableDictionary *)params;
 + (NSDictionary *)requestOrderHistory:(NSMutableDictionary *)params;
 + (void)download_file:(NSMutableDictionary *)params url:(NSString *)url toCachePath:(NSString *)path progressHandler:(progressHandler)progressHandler completionHandler:(resultHandler)result;
++ (NSDictionary *)requestKPI;
 @end

+ 26 - 0
Apex Mobile/Apex Mobile/RANetwork.m

@@ -1265,4 +1265,30 @@
     [NetworkUtils downloadFileOffset:0 Param:params from:url method:@"POST" toPath:path progressHandler:progressHandler completionHandler:result];
 }
 
++ (NSDictionary *)requestKPI {
+    
+    NSMutableDictionary *params = [NSMutableDictionary dictionary];
+    
+    [params setObject:@"hand_new_kpi" forKey:@"action"];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.personalmode)
+        params[@"personal_mode"] = @"true";
+    else
+        params[@"personal_mode"] = @"false";
+    NSData* json=[self get_json:URL_KPI parameters:params  file:nil];
+    
+    if (json==nil)
+    {
+        return @{
+                 @"result" : @RESULT_NET_ERROR,
+                 @"err_msg" : MSG_NET_ERROR
+                 };
+    }
+    
+    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:nil];
+    
+    return resultDic;
+    
+}
+
 @end

+ 2 - 0
Apex Mobile/Apex Mobile/config.h

@@ -31,6 +31,7 @@
 #define URL_NEWS                @"http://192.168.2.138/Online/Online/mobile_news.php"
 #define URL_LOCATIONS           @"http://192.168.2.138/Online/Online/mobile_news.php"
 #define URL_PUSH                @"http://192.168.2.138/Online/Online/main_new.php"
+#define URL_KPI                 @"http://192.168.2.138/Online/Online/main_new.php"
 #define URL_ERR_LOG             @""
 
 
@@ -47,6 +48,7 @@
 #define URL_NEWS                @"https://ra.apexshipping.com/mobile_news.php"
 #define URL_LOCATIONS           @"https://ra.apexshipping.com/mobile_news.php"
 #define URL_PUSH                @"https://ra.apexshipping.com/main_new.php"
+#define URL_KPI                 @"https://ra.apexshipping.com/main_new.php"
 #define URL_ERR_LOG             @""
 
 #endif