是否可以强制 MapKit 在不聚类的情况下显示所有注释?

Is it possible to force MapKit to show all annotations without clustering?

我有两个 类 都符合 MKAnnotation,我想知道,有没有办法强制 MapKit 在用户缩小和缩小时不聚集注释显示所有注释?

将 MKAnnotation 的 clusteringIdentifier 设置为 nil。

例如

class BikeView: MKMarkerAnnotationView {

    override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
        super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override var annotation: MKAnnotation? {
        willSet {
            if let bike = newValue as? Bike {
                clusteringIdentifier = nil
            }
        }
    }
}

上述解决方案对我不起作用,但此解决方案有效

final class CarPinMarkerView: MKMarkerAnnotationView {
  override var annotation: MKAnnotation? {
    willSet {
        displayPriority = MKFeatureDisplayPriority.required
    }
  }
}

希望对您有所帮助。