Răsfoiți Sursa

1.修改iOS Apex Mobile Detail Container默认选中。

Pen Li 8 ani în urmă
părinte
comite
745631e43b
1 a modificat fișierele cu 16 adăugiri și 0 ștergeri
  1. 16 0
      Apex Mobile/Apex Mobile/DetailPageViewController.m

+ 16 - 0
Apex Mobile/Apex Mobile/DetailPageViewController.m

@@ -132,6 +132,8 @@
 @property (nonatomic,weak) UITapGestureRecognizer *tap;
 @property (nonatomic,assign) BOOL showKeyboard;
 
+@property (nonatomic,strong) NSIndexPath *containerSelectedIndexPath;
+
 @end
 
 @implementation DetailPageViewController
@@ -376,6 +378,19 @@
                     
                 }];
             }
+            // 设置默认选中第一个Container
+            for (NSInteger i = 0; i < self.content.segments.count; i++) {
+                
+                NSMutableDictionary* segment = [self.content.segments[i] mutableCopy];
+                NSString* type =[segment valueForKey:@"_type"];
+                
+                if([type isEqualToString:@"tracking"]) {
+                    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:i];
+                    [self.table selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
+                    [self tableView:self.table didSelectRowAtIndexPath:indexPath];
+                    break;
+                }
+            }
             
             //            [self.table setNeedsDisplay];
             //            if(self.recordCount<2000)
@@ -1369,6 +1384,7 @@
     if([type isEqualToString:@"tracking"]) {
         NSDictionary *location = [segment objectForKey:@"location"];
         [self.shipMap showShipAnnotaion:location];
+        self.containerSelectedIndexPath = indexPath;
     }