I want to show the title of the pin(MKAnnotation)every time when I added the annotation.I added the following code for that.But it is not working.Please help me to find out. I just added the pin like this.
ann = [[DisplayMap alloc] init];
ann.title = @"aaa";
ann.subtitle = @"bbbn";
[mapView addAnnotation:ann];
after that i added the following code in this method
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation
{
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"com.invasivecode.pin";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil )
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
pinView.selected = YES;
[mapView selectAnnotation:annotation animated:YES];
//[pinView setImage:[UIImage imageNamed:@"user.png"]];
}
}
what mistake I have done?