MapView annotation
I have added an image on annotation view and when i am touching annotation view its image is changeing into red pin can any one tell me what's he reason for it
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKPinAnnotationView* newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"];
if (annotation == _mapView.userLocation)
{
newAnnotation.rightCalloutAccessoryView = [UIButton开发者_开发技巧 buttonWithType:UIButtonTypeDetailDisclosure];
return nil;
}
//[newAnnotation setSelected:YES];
newAnnotation.image = [UIImage imageNamed:@"sample.png"];
newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
newAnnotation.canShowCallout = YES;
[newAnnotation retain];
return newAnnotation;
}
Make the newAnnotation
a MKAnnotationView
rather than a MKPinAnnotationView
.
精彩评论