De acuerdo con los documentos de Apple, el color del pin de MKPinAnnotationView está disponible en rojo, verde y morado. ¿Hay alguna manera de obtener otros colores también? No he encontrado nada en los documentos.
MKPinAnnotationView: ¿Hay más de tres colores disponibles?
algo mas ;)
texto alternativo http://lionel.gueganton.free.fr/pins/pinGray.png

texto alternativo http://lionel.gueganton.free.fr/pins/pinOrange.png

Y los originales:
texto alternativo http://lionel.gueganton.free.fr/pins/pinGreen.png

texto alternativo http://lionel.gueganton.free.fr/pins/pinPurple.png

texto alternativo http://lionel.gueganton.free.fr/pins/pinRed.png

Y el código:
- (MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
MKPinAnnotationView* anView =[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"test"];
anView.pinColor=MKPinAnnotationColorPurple;
UIImage* image = nil;
// 2.0 is for retina. Use 3.0 for iPhone6+, 1.0 for "classic" res.
UIGraphicsBeginImageContextWithOptions(anView.frame.size, NO, 2.0);
[anView.layer renderInContext: UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData* imgData = UIImagePNGRepresentation(image);
NSString* targetPath = [NSString stringWithFormat:@"%@/%@", [self writablePath], @"thisismypin.png" ];
[imgData writeToFile:targetPath atomically:YES];
return anView;
}
-(NSString*) writablePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return documentsDirectory;
}
Puede que le resulte de utilidad las siguientes imágenes:

y el código para utilizarlos en viewForAnnotation :
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
// ... get the annotation delegate and allocate the MKAnnotationView (annView)
if ([annotationDelegate.type localizedCaseInsensitiveCompare:@"NeedsBluePin"] == NSOrderedSame)
{
UIImage * image = [UIImage imageNamed:@"blue_pin.png"];
UIImageView *imageView = [[[UIImageView alloc] initWithImage:image] autorelease];
[annView addSubview:imageView];
}
// ...
Se podría utilizar ZSPinAnnotationpara crear pasadores de anotación sobre la marcha con una especificada UIColor: https://github.com/nnhubbard/ZSPinAnnotation
Me gustaría respuesta Yonel pero sólo una mano a mano, cuando se crea una costumbre MKAnnotationView, tendrá que asignar manualmente el desplazamiento. Para las imágenes de Yonel proporcionado: (se puede dejar de lado las cosas calloutButton si usted no necesita uno de esos)
#pragma mark MKMapViewDelegate
- (MKAnnotationView *)mapView:(MKMapView *)aMapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if(![annotation isKindOfClass:[MyAnnotation class]]) // Don't mess user location
return nil;
MKAnnotationView *annotationView = [aMapView dequeueReusableAnnotationViewWithIdentifier:@"spot"];
if(!annotationView)
{
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"spot"];
annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[(UIButton *)annotationView.rightCalloutAccessoryView addTarget:self action:@selector(openSpot:) forControlEvents:UIControlEventTouchUpInside];
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
annotationView.centerOffset = CGPointMake(7,-15);
annotationView.calloutOffset = CGPointMake(-8,0);
}
// Setup annotation view
annotationView.image = [UIImage imageNamed:@"pinYellow.png"]; // Or whatever
return annotationView;
}
Con iOS 9, pinTintColorse ha agregado a MKPinAnnotationView, lo que le permite proporcionar una UIColorpara el color de alfiler.
Y aquí está el PSD para el pin con sombra y su tamaño en @ 2x.
http://dl.dropbox.com/u/5622711/ios-pin.psd
Utilice esta PSD para cualquier color que usted quiere :)
Tomo ningún crédito para este PSD. Yo sólo lo agarré de http://www.teehanlax.com/downloads/iphone-4-guid-psd-retina-display/ Han hecho un trabajo maravilloso!
Ninguna de las soluciones publicado trabajos 100% si está utilizando la animación caída de un alfiler. La solución de Cañoneo es muy ordenada, ya que permite que el pasador todavía tienen ambos tipos de extremos (la punta afilada cuando se caen y el que tiene la ondulación de papel circular), pero por desgracia una idea de la cabeza de color pin original se puede ver cuando los rebotes pin como se golpea el mapa. solución de reemplazar la imagen de pin conjunto de yonel significa el pasador cae con la ondulación del papel circular antes de que incluso se dio en el mapa!
He intentado de esta manera y parece estar bien ...
UIImage * image = [UIImage imageNamed:@"blue_pin.png"];
UIImageView *imageView = [[[UIImageView alloc] initWithImage:image]
autorelease];
[annotationView addSubview:imageView];
annotationView = nil;
utilizando la imagen de pin completa ... como el ejemplo yonel
Si no está en los documentos, entonces probablemente no, puede usar mkannotationview y tener su propia imagen si lo desea.













