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

1.修改iOS Apex Drivers首页通知处理。

Pen Li 7 лет назад
Родитель
Сommit
edd1b704f8

+ 3 - 2
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m

@@ -202,11 +202,12 @@
                 if (result == RESULT_TRUE) {
                     
                     [[NSNotificationCenter defaultCenter] postNotificationName:RANotificationReloadHome object:nil];
-                    [strongSelf.navigationController popViewControllerAnimated:YES];
+                    [strongSelf.navigationController popToRootViewControllerAnimated:YES];
                     
                 } else {
                     // process error
-                    
+                    NSString *msg = [json objectForKey:@"err_msg"];
+                    [strongSelf showAlertTilte:@"Warning" message:msg];
                 }
             }
             

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

@@ -43,7 +43,7 @@ typedef enum {
     // Do any additional setup after loading the view.
     
     [self configureTableView];
-    
+    [self registNotification];
     [self loadData];
 }
 
@@ -52,6 +52,10 @@ typedef enum {
     // Dispose of any resources that can be recreated.
 }
 
+- (void)dealloc {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
 #pragma mark - Configure
 
 - (void)configureTableView {
@@ -75,6 +79,11 @@ typedef enum {
     self.homeMoreTableView.jl_footer = self.refreshFooter;
 }
 
+- (void)registNotification {
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNewOrderNotification:) name:RANotificationNewOrder object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveReloadNotification:) name:RANotificationReloadHome object:nil];
+}
+
 #pragma mark - Lazy
 
 - (NSMutableArray<RAHomeOrderModel *> *)orderArray {
@@ -214,5 +223,15 @@ typedef enum {
     
 }
 
+#pragma mark - Nofitication Selector
+
+- (void)receiveNewOrderNotification:(NSNotification *)notification {
+    [self loadData];
+}
+
+- (void)receiveReloadNotification:(NSNotification *)notification {
+    [self loadData];
+}
+
 
 @end

+ 1 - 1
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m

@@ -155,7 +155,7 @@
 
 - (void)registNotification {
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNewOrderNotification:) name:RANotificationNewOrder object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNewOrderNotification:) name:RANotificationReloadHome object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveReloadNotification:) name:RANotificationReloadHome object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveGoDetailNotification:) name:RANotificationGoDetail object:nil];
 }