Z-index of iOS MapKit user location annotation

后端 未结 9 2309
天命终不由人
天命终不由人 2020-12-13 07:12

I need to draw the current user annotation (the blue dot) on top of all other annotations. Right now it is getting drawn underneath my other annotations and getting hidden.

9条回答
  •  佛祖请我去吃肉
    2020-12-13 07:33

    Using Underscore.m

    _.array(mapView.annotations).
        filter(^ BOOL (id annotation) { return [annotation 
    isKindOfClass:[MKUserLocation class]]; })
        .each(^ (id annotation) { [[[mapView 
    viewForAnnotation:annotation] superview] bringSubviewToFront:[mapView 
    viewForAnnotation:annotation]]; });
    

提交回复
热议问题