소스 검색

fix:设置圆头。

zhoukun 6 달 전
부모
커밋
392466c648
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      plugins/map_mapkit_ios/ios/Classes/MapView/Views/MapAnnotationView.swift

+ 6 - 1
plugins/map_mapkit_ios/ios/Classes/MapView/Views/MapAnnotationView.swift

@@ -89,7 +89,12 @@ class MapAnnotationView: MKAnnotationView {
         guard let markerImageView = markerImageView else { return }
         markerImageView.translatesAutoresizingMaskIntoConstraints = false
         
-        let markerSize = marker?.markerType.size ?? CGSize(width: 30, height: 30)
+        var markerSize = marker?.markerType.size ?? CGSize(width: 30, height: 30)
+        if let url = marker?.customAvatarUrl, !url.isEmpty {
+            markerSize = CGSize(width: 52, height: 52)
+            markerImageView.layer.cornerRadius = 52 / 2
+            markerImageView.layer.masksToBounds = true // 确保超出部分被裁剪
+        }
         
         // 设置图像视图约束 - 居中显示在标记视图中
         NSLayoutConstraint.activate([