|
|
@@ -25,7 +25,7 @@ typedef enum {
|
|
|
HomeModeKPI = 1
|
|
|
} HomeMode;
|
|
|
|
|
|
-@interface HomeViewController () <UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,KPIDelegate,ShipCellDelegate>
|
|
|
+@interface HomeViewController () <UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,KPIDelegate,ShipCellDelegate,AMShipMapDelegate>
|
|
|
|
|
|
@property (strong, nonatomic) IBOutlet UISegmentedControl *segmentControl;
|
|
|
|
|
|
@@ -142,6 +142,8 @@ typedef enum {
|
|
|
self.mapView.showPor = YES;
|
|
|
self.mapView.showOrigin = YES;
|
|
|
self.mapView.showDestination = YES;
|
|
|
+
|
|
|
+ self.mapView.delegate = self;
|
|
|
}
|
|
|
|
|
|
- (void)configureNavigationBar {
|
|
|
@@ -850,4 +852,65 @@ typedef enum {
|
|
|
[self setSelectedIndexPath:indexPath shipCell:cell];
|
|
|
}
|
|
|
|
|
|
+#pragma mark - ShipMap Delegate
|
|
|
+
|
|
|
+- (void)shipMap:(AMShipMap *)shipMap tryToZoomIn:(BOOL)zoomIn {
|
|
|
+
|
|
|
+ if (zoomIn) {
|
|
|
+
|
|
|
+ NSArray *constraints = self.ShipContainer.constraints;
|
|
|
+ NSLayoutConstraint *h_ratio_constraint = nil;
|
|
|
+
|
|
|
+ for (NSLayoutConstraint *constraint in constraints) {
|
|
|
+ if (constraint.identifier && [constraint.identifier isEqualToString:@"map_height_ratio"]) {
|
|
|
+ h_ratio_constraint = constraint;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (h_ratio_constraint) {
|
|
|
+ [self.ShipContainer removeConstraint:h_ratio_constraint];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSLayoutConstraint *table_h_constraint = [NSLayoutConstraint constraintWithItem:self.shipTableView
|
|
|
+ attribute:NSLayoutAttributeHeight
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
+ toItem:nil
|
|
|
+ attribute:NSLayoutAttributeNotAnAttribute
|
|
|
+ multiplier:0
|
|
|
+ constant:120.0f];
|
|
|
+ table_h_constraint.identifier = @"ship_table_height";
|
|
|
+ [self.ShipContainer addConstraint:table_h_constraint];
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ NSArray *constraints = self.ShipContainer.constraints;
|
|
|
+ NSLayoutConstraint *h_constraint = nil;
|
|
|
+
|
|
|
+ for (NSLayoutConstraint *constraint in constraints) {
|
|
|
+ if (constraint.identifier && [constraint.identifier isEqualToString:@"ship_table_height"]) {
|
|
|
+ h_constraint = constraint;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (h_constraint) {
|
|
|
+ [self.ShipContainer removeConstraint:h_constraint];
|
|
|
+ }
|
|
|
+
|
|
|
+ float h_ratio = 0.5;
|
|
|
+ NSLayoutConstraint *h_ratio_constraint = [NSLayoutConstraint constraintWithItem:shipMap
|
|
|
+ attribute:NSLayoutAttributeHeight
|
|
|
+ relatedBy:NSLayoutRelationEqual
|
|
|
+ toItem:self.shipTableView
|
|
|
+ attribute:NSLayoutAttributeHeight
|
|
|
+ multiplier:h_ratio
|
|
|
+ constant:0];
|
|
|
+ h_ratio_constraint.identifier = @"map_height_ratio";
|
|
|
+
|
|
|
+ [self.ShipContainer addConstraint:h_ratio_constraint];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [self.ShipContainer layoutIfNeeded];
|
|
|
+}
|
|
|
+
|
|
|
@end
|