din*_*awr 4 mapkit mkannotation ios swift
我有两个类都符合MKAnnotation,我想知道,MapKit当用户缩小并显示所有注释时,有没有办法强制不聚集注释?
提到的解决方案对我不起作用,但这个解决方案有效:
final class CarPinMarkerView: MKMarkerAnnotationView {
override var annotation: MKAnnotation? {
willSet {
displayPriority = MKFeatureDisplayPriority.required
}
}
}
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你。
将 MKAnnotation 设置clusteringIdentifier为零。
例如
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
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1969 次 |
| 最近记录: |