W widoku MKMap dostosowałem pinezkę do adnotacji z obrazem. Ale niektóre szpilki są statyczne i nie pokazują danego obrazu.Pokazuje różne obrazy Pin w MKMapview
Używam - (MKAnnotationView *) mapView: (MKMapView *) mapView viewForAnnotation: (id) adnotacja, aby ustawić obraz pinezki.
Dodanie mój kod i ekranu tutaj:
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKPinAnnotationView* pinView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier];
pinView.animatesDrop=YES;
pinView.canShowCallout=YES;
pinView.pinColor= MKPinAnnotationColorGreen;
pinView.enabled = YES;
pinView.canShowCallout = YES;
pinView.image=[UIImage imageNamed:@"bublerest.png"]; //here I am giving the image
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton setTitle:annotation.title forState:UIControlStateNormal];
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView = rightButton;
UIImageView *profileIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"rest_image2.png"]];
pinView.leftCalloutAccessoryView = profileIconView;
return pinView;
}
pomysłów?
Czy widzisz w ogóle swoje własne ikony map dla dowolnej pinezki, czy tylko niektóre pinezki ich nie pokazują? – Zhang