Эх сурвалжийг харах

1.修改iOS Apex Mobile增加地图位置图标。

Pen Li 8 жил өмнө
parent
commit
e08924fa72
25 өөрчлөгдсөн 156 нэмэгдсэн , 9 устгасан
  1. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/Contents.json
  2. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/location_destination.png
  3. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/location_destination@2x.png
  4. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/location_destination@3x.png
  5. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/Contents.json
  6. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/location_origin.png
  7. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/location_origin@2x.png
  8. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/location_origin@3x.png
  9. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/Contents.json
  10. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/location_pod.png
  11. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/location_pod@2x.png
  12. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/location_pod@3x.png
  13. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/Contents.json
  14. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/location_poe.png
  15. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/location_poe@2x.png
  16. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/location_poe@3x.png
  17. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/Contents.json
  18. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/location_pol.png
  19. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/location_pol@2x.png
  20. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/location_pol@3x.png
  21. 23 0
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/Contents.json
  22. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/location_por.png
  23. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/location_por@2x.png
  24. BIN
      Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/location_por@3x.png
  25. 18 9
      Apex Mobile/Apex Mobile/ShipMap/AMShipMap.m

+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "location_destination.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_destination@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_destination@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/location_destination.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/location_destination@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_destination.imageset/location_destination@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "location_origin.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_origin@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_origin@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/location_origin.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/location_origin@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_origin.imageset/location_origin@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "location_pod.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_pod@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_pod@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/location_pod.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/location_pod@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pod.imageset/location_pod@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "location_poe.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_poe@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_poe@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/location_poe.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/location_poe@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_poe.imageset/location_poe@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "location_pol.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_pol@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_pol@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/location_pol.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/location_pol@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_pol.imageset/location_pol@3x.png


+ 23 - 0
Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "location_por.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_por@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "location_por@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/location_por.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/location_por@2x.png


BIN
Apex Mobile/Apex Mobile/NewImages.xcassets/location_por.imageset/location_por@3x.png


+ 18 - 9
Apex Mobile/Apex Mobile/ShipMap/AMShipMap.m

@@ -22,6 +22,7 @@ typedef enum {
 @interface AMShipAnnotation : MKPointAnnotation
 
 @property (nonatomic,assign) AMShipAnnotationPriority priority;
+@property (nonatomic,copy) NSString *imageName;
 
 @end
 
@@ -37,7 +38,7 @@ typedef enum {
 
 @implementation AMShipMap
 
-- (void)handleLoaction:(NSDictionary *)location Priority:(AMShipAnnotationPriority)priority {
+- (void)handleLoaction:(NSDictionary *)location Priority:(AMShipAnnotationPriority)priority ImageName:(NSString *)imgName {
     if (location == nil) {
         return;
     }
@@ -58,6 +59,7 @@ typedef enum {
         ann.title = name;
         ann.subtitle = addr;
         ann.priority = priority;
+        ann.imageName = imgName;
         
         // 将大头针数据模型添加到MKMapView上管理
         [self.mapView addAnnotation:ann];
@@ -104,37 +106,37 @@ typedef enum {
     if (locationInfo) {
         NSDictionary *pol = [locationInfo objectForKey:@"pol"];
         if (self.showPol) {
-            [self handleLoaction:pol Priority:AMShipAnnotationPriorityHigh];
+            [self handleLoaction:pol Priority:AMShipAnnotationPriorityHigh ImageName:@"location_pol"];
         }
         
         NSDictionary *pod = [locationInfo objectForKey:@"pod"];
         if (self.showPod) {
-            [self handleLoaction:pod Priority:AMShipAnnotationPriorityHigh];
+            [self handleLoaction:pod Priority:AMShipAnnotationPriorityHigh  ImageName:@"location_pod"];
         }
         
         NSDictionary *poe = [locationInfo objectForKey:@"poe"];
         if (self.showPoe) {
-            [self handleLoaction:poe Priority:AMShipAnnotationPriorityLow];
+            [self handleLoaction:poe Priority:AMShipAnnotationPriorityLow  ImageName:@"location_poe"];
         }
         
         NSDictionary *por = [locationInfo objectForKey:@"por"];
         if (self.showPor) {
-            [self handleLoaction:por Priority:AMShipAnnotationPriorityLow];
+            [self handleLoaction:por Priority:AMShipAnnotationPriorityLow  ImageName:@"location_por"];
         }
         
         NSDictionary *origin = [locationInfo objectForKey:@"origin"];
         if (self.showOrigin) {
-            [self handleLoaction:origin Priority:AMShipAnnotationPriorityLow];
+            [self handleLoaction:origin Priority:AMShipAnnotationPriorityLow  ImageName:@"location_origin"];
         }
         
         NSDictionary *destination = [locationInfo objectForKey:@"destination"];
         if (self.showDestination) {
-            [self handleLoaction:destination Priority:AMShipAnnotationPriorityLow];
+            [self handleLoaction:destination Priority:AMShipAnnotationPriorityLow  ImageName:@"location_destination"];
         }
         
         NSDictionary *current = [locationInfo objectForKey:@"current"];
         if (self.showCurrent) {
-            [self handleLoaction:current Priority:AMShipAnnotationPriorityRequired];
+            [self handleLoaction:current Priority:AMShipAnnotationPriorityRequired  ImageName:@"ic_marker"];
         }
         [self moveToLocation:current];
     }
@@ -152,8 +154,15 @@ typedef enum {
         if (!pinView) { // 如果没有可重用的大头针视图就创建并指定重用标识
             pinView = [[AMAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"PIN"];
         }
-        pinView.image = [UIImage imageNamed:@"ic_marker"];        
+
         AMShipAnnotation *shipAnnotation = (AMShipAnnotation *)annotation;
+        
+        if (shipAnnotation.imageName) {
+            pinView.image = [UIImage imageNamed:shipAnnotation.imageName];
+        } else {
+            pinView.image = [UIImage imageNamed:@"ic_marker"];
+        }
+        
         if (@available(iOS 11,*)) {
             if (shipAnnotation.priority == AMShipAnnotationPriorityRequired) {
                 pinView.displayPriority = MKFeatureDisplayPriorityRequired;