开发者

How to present Blue circle of current location in MKMapView iphone

I have an maps applicat开发者_StackOverflow社区ion in which I show the points of interest in the map using pins. I want to represent the current location with the blue circle which is shown in Google maps. Is there any way we can add it. Can any one please help me with this. I really appreciate your time.

Thanks


You can get this by specifying nil in the appropriate delegate method:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation: (id<MKAnnotation>)annotation {
    if (annotation == mapView.userLocation) {
        return nil;
    }
}

This should cause MKMapView to use the default, which should be the blue circle.


You should set the setShowsUserLocation: property of your map view to YES. This can be done programmatically or in Interface Builder. Be careful, as I believe the simulator still shows the user location in Cupertino, CA.

Also, if you continue tracking the user and their movements, the blue indicator will continue to move as they do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜