Je suis en train d'implémenter une application basée sur MKMapView. En ce que j'utilise une image personnalisée au lieu d'afficher une épingle en utilisant la propriété MKAnnotationView.Image. Cela fonctionne bien. Mais j'ai eu un problème avec l'affichage de la broche, il montre dans l'océan. Lorsque j'ai utilisé la broche par défaut, cela fonctionne bien. Je ne sais pas quel est le problème. Pouvez-vous me suggérer s'il vous plaît? Aidez-moi, s'il vous plaît.Problème avec la propriété d'image MKAnnotation
cityAnnotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"CityAnnotation"] autorelease];
//cityAnnotationView.image = [[UIImage imageNamed:@"city_pin.png"] stretchableImageWithLeftCapWidth:100 topCapHeight:10];
cityAnnotationView.image = [UIImage imageNamed:@"city_pin.png"];
cityAnnotationView.backgroundColor=[UIColor clearColor];
cityAnnotationView.annotation = annotation;
cityAnnotationView.canShowCallout = NO;
cityAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
Merci d'avance. Sekhar.
pouvez-vous poster du code afin que je puisse vous aider à résoudre ce problème ... –
cityAnnotationView = [[[MKAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: @ "CityAnnotation"] autorelease]; \t \t \t \t //cityAnnotationView.image = [[UIImage imageNamed: @ "city_pin.png"] stretchableImageWithLeftCapWidth: 100 topCapHeight: 10]; \t \t \t \t cityAnnotationView.image = [UIImage imageNamed: @ "city_pin.png"]; \t \t \t \t cityAnnotationView.backgroundColor = [UIColor clearColor]; \t \t \t \t cityAnnotationView.annotation = annotation; \t \t \t \t cityAnnotationView.canShowCallout = NO; \t \t \t \t cityAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType: UIButtonTypeDetailDisclosure]; – sekhar
Ceci est le code de la vue d'annotation. Affiche le code qui crée l'annotation, y compris la façon dont les coordonnées sont définies. – Anna