自定义MAAnnotationView
https://izumi.pub/iOS/iOS-amap-sdk/
2.点击无反应
override init?(annotation: MAAnnotation?, reuseIdentifier: String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) buildUI() customView.addTapGestureRecognizer { [weak self] in guard let self = self else { return } clickHandle?(self.shopModel) } } 要加上下边方法才有交互 override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { var view = super.hitTest(point, with: event) if view == nil { if customView.bounds.contains(customView.convert(point, from: self)) { view = customView } } return view }
参考:
高德地图自定义AnnotationView没有交互效果的解决思路
https://blog.csdn.net/myfather103/article/details/126579643