通过判断 title 来设置自定义图片,在代理方法中:
-(MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id )annotation { MKAnnotationView *newAnnotation=[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"]; if ([[annotation title] isEqualToString:@"当前位置"]) { newAnnotation.image = [UIImage imageNamed:@"person_location"]; } else{ newAnnotation.image = [UIImage imageNamed:@"login_logo_small"]; } newAnnotation.canShowCallout=YES; return newAnnotation; }