本文介绍了当MKMapView showsUserLocation == YES时隐藏MKUserLocation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mapView.showsUserLocation设置为true后,是否可以在不显示MKUserLocation气泡的情况下接收位置更新?在mapView:viewForAnnotation:中返回nil只会显示气泡,而返回任何其他类型的注释都将显示注释,

After setting mapView.showsUserLocation to true, is it possible to receive location updates without showing the MKUserLocation bubble? Returning nil in mapView:viewForAnnotation: simply shows the bubble, and returning any other kind of annotation shows an annotation, which I don't want.

推荐答案

您可以在didAddAnnotationViews委托方法中隐藏用户位置的视图:

You can hide the user location's view in the didAddAnnotationViews delegate method:

-(void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
    MKAnnotationView *ulv = [mapView viewForAnnotation:mapView.userLocation];
    ulv.hidden = YES;
}

这篇关于当MKMapView showsUserLocation == YES时隐藏MKUserLocation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 11:51