Az Apple docs, MKPinAnnotationView PIN szín áll a piros, zöld és lila. Van-e bármilyen módon, hogy más színben is? Már semmit sem találtak a docs.
MKPinAnnotationView: Vannak több mint három színben kapható?
néhány ;)
alt szöveg http://lionel.gueganton.free.fr/pins/pinGray.png

alt szöveg http://lionel.gueganton.free.fr/pins/pinOrange.png

És az eredeti is:
alt szöveg http://lionel.gueganton.free.fr/pins/pinGreen.png

alt szöveg http://lionel.gueganton.free.fr/pins/pinPurple.png

alt szöveg http://lionel.gueganton.free.fr/pins/pinRed.png

És a kódot:
- (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;
}
Lehet, hogy a következő képeket hasznos:

és a kódot kell használni őket 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];
}
// ...
Jól jönne ZSPinAnnotationlétre kommentár csapok menet közben egy meghatározott UIColor: https://github.com/nnhubbard/ZSPinAnnotation
Szeretem yonel válasza , de csak egy heads-up, amikor létrehoz egy egyéni MKAnnotationView, akkor kézzel kell kijelölni az eltolás. A képek yonel feltéve: (akkor hagyja ki a calloutButton dolog, ha nem kell egy ilyen)
#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;
}
Az iOS 9, pinTintColorbővült a MKPinAnnotationView, amely lehetővé teszi, hogy a kínálat UIColora csap színe.
És itt van a PSD a csap az árnyék és a @ 2x méretű.
http://dl.dropbox.com/u/5622711/ios-pin.psd
Használja ezt a PSD bármilyen kívánt színt :)
Nem az én érdemem erre PSD. Én csak megragadta azt http://www.teehanlax.com/downloads/iphone-4-guid-psd-retina-display/ Ők nagyszerű munkát végzett!
Sem a kiküldött megoldások működnek 100%, ha használja a döngését animáció. Ágyúzás a megoldás nagyon ügyes, mert lehetővé teszi a csap, hogy még mindig van mindkét fajta végek (az éles pont, amikor esik, és az egyik a kör alakú papír fodrozódás), de sajnos egy pillantást az eredeti pin fej szín látható, amikor a csap pattog, mint eléri a térképet. yonel-oldat helyett a teljes csap kép: a csap alá a kör alakú papírt fodrozódás, mielőtt még megüt a térképen!
Próbáltam így, és úgy tűnik, hogy rendben van ...
UIImage * image = [UIImage imageNamed:@"blue_pin.png"];
UIImageView *imageView = [[[UIImageView alloc] initWithImage:image]
autorelease];
[annotationView addSubview:imageView];
annotationView = nil;
a komplett pin kép ... a yonel példa
Ha ez nem a dokumentációban, akkor nagy valószínűséggel nem, akkor használja mkannotationview és ur saját képet, ha u kíván bár













