Wednesday 20 July 2011

Customizing user current location Annotation

Hi ,
We all know when Our Current Location is shown as blue dot on mapView.
There are some situations when we have to show some other annotation rather than blue dot.

Here's the code by which you can customize your current location

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
if (annotation == mapView.userLocation)
{
//return nil;
MKPinAnnotationView *customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil] autorelease];
if (annotation == mapView.userLocation)
customPinView.image = [UIImage imageNamed:@"userLocImgae.png"];//write image name that you want to show
return customPinView;
}
Happy Coding:)

No comments:

Post a Comment