How to define the order of overlapping MKAnnotationViews?

后端 未结 7 1421
谎友^
谎友^ 2020-11-30 06:29

I have several MKAnnotations (and their corresponding views) in my map, and it sometimes gets really crowded. Now, the annotations in my app come in two flavors: some are bo

7条回答
  •  醉酒成梦
    2020-11-30 07:00

    In the delegate function, you can select the pin to force it on top:

    func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?` {
        ...
        if my annotation is the special one {
            annotationView.isSelected = true
        }
        ...
    }
    

提交回复
热议问题