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

1.修改Apex Mobile Detail WebView垂直滑动。

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

+ 28 - 0
Apex Mobile/Apex Mobile/DetailCellWeb.m

@@ -35,4 +35,32 @@
     // Configure the view for the selected state
 }
 
+- (void)willMoveToSuperview:(UIView *)newSuperview {
+    
+    
+    
+    if (newSuperview) {
+        NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld;
+        [self.webView.scrollView addObserver:self forKeyPath:@"contentSize" options:options context:nil];
+    } else {
+        [self.webView.scrollView removeObserver:self forKeyPath:@"contentSize"];
+    }
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
+    
+    if ([keyPath isEqualToString:@"contentSize"]) {
+        
+//        NSLog(@"contentSize");
+        
+//        CGSize old = [change[@"old"] CGSizeValue];
+        CGSize new = [change[@"new"] CGSizeValue];
+        
+        if (new.height != 0) {
+            self.webView.scrollView.contentSize = CGSizeMake(new.width, 0);
+        }
+        
+    }
+}
+
 @end

+ 29 - 29
Apex Mobile/Apex Mobile/OrderHistoryViewController.m

@@ -226,37 +226,37 @@ static const int history_delta = 7;
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     
-//    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
-//
-//    [params setObject:@"dumb" forKey:@"id"];
-//    NSString* h_field;
-//    //if(self.radioContainer.selected==true)
-//    //{
-//    //    [params setObject:@"1" forKey:@"criterion_type"];
-//    //    h_field = @"ctnr";
-//    //}
-//    //else
-//    {
-//        [params setObject:@"0" forKey:@"criterion_type"];
-//        h_field = @"h_bol";
-//    }
-//
-//    NSDictionary *item = [self.shipArray objectAtIndex:indexPath.section];
-//    NSString * cargo_criterion = item[@"hbol"];
-//    if(cargo_criterion==nil)
-//        cargo_criterion=@"";
-//    [params setObject:cargo_criterion forKey:@"cargo_criterion"];
-//
-//
-//    [ApexMobileDB savehistory:h_field value:cargo_criterion];
-//
-//    DetailTabBarController *detailViewController=[[DetailTabBarController alloc] init:@"Cargo Tracking" actions:[NSArray arrayWithObjects:@"Tracking",nil] params:params];
-//    [self.navigationController pushViewController:detailViewController animated:YES];
+    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
+
+    [params setObject:@"dumb" forKey:@"id"];
+    NSString* h_field;
+    //if(self.radioContainer.selected==true)
+    //{
+    //    [params setObject:@"1" forKey:@"criterion_type"];
+    //    h_field = @"ctnr";
+    //}
+    //else
+    {
+        [params setObject:@"0" forKey:@"criterion_type"];
+        h_field = @"h_bol";
+    }
+
+    NSDictionary *item = [self.shipArray objectAtIndex:indexPath.section];
+    NSString * cargo_criterion = item[@"hbol"];
+    if(cargo_criterion==nil)
+        cargo_criterion=@"";
+    [params setObject:cargo_criterion forKey:@"cargo_criterion"];
+
+
+    [ApexMobileDB savehistory:h_field value:cargo_criterion];
+
+    DetailTabBarController *detailViewController=[[DetailTabBarController alloc] init:@"Cargo Tracking" actions:[NSArray arrayWithObjects:@"Tracking",nil] params:params];
+    [self.navigationController pushViewController:detailViewController animated:YES];
     
     
-    AMResultViewController *resultVC = [[AMResultViewController alloc] initWithNibName:@"Result" bundle:nil];
-    resultVC.params = [NSMutableDictionary dictionary];
-    [self.navigationController pushViewController:resultVC animated:YES];
+//    AMResultViewController *resultVC = [[AMResultViewController alloc] initWithNibName:@"Result" bundle:nil];
+//    resultVC.params = [NSMutableDictionary dictionary];
+//    [self.navigationController pushViewController:resultVC animated:YES];
     
 }
 

+ 39 - 39
Apex Mobile/Apex Mobile/SearchViewController.m

@@ -316,46 +316,46 @@
 
 - (IBAction)SearchBtnOnClick:(UIButton *)sender {
     
-//    GridResultViewController *resultViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
-//    resultViewController.function_name = self.function_name;
-////    if([self.function_name isEqualToString:@"Document Download"])
-////        resultViewController.fullrow_select =false;
-////    else
-////        resultViewController.fullrow_select=true;
-//    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
-//
-//    for(int i=0;i<[_adapter get_itemcount];i++)
-//    {
-//        NSMutableDictionary * field =[_adapter get_item:i];
-//        if([[field valueForKey:@"type"] isEqualToString:@"time"])
-//        {
-//            NSString* str_from= [field valueForKey:@"from"];
-//            NSString* str_to= [field valueForKey:@"to"];
-//
-//            if(str_from.length>0)
-//                [params setValue:str_from forKey:[NSString stringWithFormat:@"%@_from",[field valueForKey:@"name"]]];
-//            if(str_to.length>0)
-//                [params setValue:str_to forKey:[NSString stringWithFormat:@"%@_to",[field valueForKey:@"name"]]];
-//        }
-//        else
-//        {
-//            NSString* value =[field valueForKey:@"value"];
-//            if(value.length>0)
-//            {
-//                [params setValue:[field valueForKey:@"value"] forKey:[field valueForKey:@"name"]];
-//                if([[field valueForKey:@"type"] isEqualToString:@"string"] )
-//                {
-//                     [ApexMobileDB savehistory:[field valueForKey:@"name"] value:[field valueForKey:@"value"]];
-//                }
-//            }
-//        }
-//    }
-//    [params setValue:self.function_name forKey:@"module_name"];
-//    resultViewController.params =params;
-//    [self.navigationController pushViewController:resultViewController animated:YES];
+    GridResultViewController *resultViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
+    resultViewController.function_name = self.function_name;
+//    if([self.function_name isEqualToString:@"Document Download"])
+//        resultViewController.fullrow_select =false;
+//    else
+//        resultViewController.fullrow_select=true;
+    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
+
+    for(int i=0;i<[_adapter get_itemcount];i++)
+    {
+        NSMutableDictionary * field =[_adapter get_item:i];
+        if([[field valueForKey:@"type"] isEqualToString:@"time"])
+        {
+            NSString* str_from= [field valueForKey:@"from"];
+            NSString* str_to= [field valueForKey:@"to"];
+
+            if(str_from.length>0)
+                [params setValue:str_from forKey:[NSString stringWithFormat:@"%@_from",[field valueForKey:@"name"]]];
+            if(str_to.length>0)
+                [params setValue:str_to forKey:[NSString stringWithFormat:@"%@_to",[field valueForKey:@"name"]]];
+        }
+        else
+        {
+            NSString* value =[field valueForKey:@"value"];
+            if(value.length>0)
+            {
+                [params setValue:[field valueForKey:@"value"] forKey:[field valueForKey:@"name"]];
+                if([[field valueForKey:@"type"] isEqualToString:@"string"] )
+                {
+                     [ApexMobileDB savehistory:[field valueForKey:@"name"] value:[field valueForKey:@"value"]];
+                }
+            }
+        }
+    }
+    [params setValue:self.function_name forKey:@"module_name"];
+    resultViewController.params =params;
+    [self.navigationController pushViewController:resultViewController animated:YES];
     
-    AMResultViewController *resultVC = [[AMResultViewController alloc] initWithNibName:@"Result" bundle:nil];
-    [self.navigationController pushViewController:resultVC animated:YES];
+//    AMResultViewController *resultVC = [[AMResultViewController alloc] initWithNibName:@"Result" bundle:nil];
+//    [self.navigationController pushViewController:resultVC animated:YES];
 }