show users location blue point in iPhone MKMapView

99封情书 提交于 2019-12-03 03:13:26

Add this to the top of the viewForAnnotation method:

if ([annotation isKindOfClass:[MKUserLocation class]])
    return nil;

The special user location annotation is of type MKUserLocation and returning nil in that case tells the map view to draw the default view for it which is the blue dot.

You can also remove these lines since they will no longer be needed:

if ([[annotation title] isEqualToString:NSLocalizedString(@"Current Location",@"")])  {
    MKPinAnnotationView *pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
    //pin.pinColor = MKPinAnnotationColorRed;
    annotationView = pin;
}
else
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!