Tengo un MKMapView
anotaciones y yo estoy añadiendo así:MKAnnotation no se muestra en la llamada MKMapView
for (NSDictionary *tmp in response)
{
NSDictionary *places = [tmp objectForKey:@"place"];
NSDictionary *location = [places objectForKey:@"location"];
NSLog(@"long: %@ Lat:%@",[location objectForKey:@"longitude"], [location objectForKey:@"latitude"]);
float longitude = [[location objectForKey:@"longitude"] floatValue];
float latitude = [[location objectForKey:@"latitude"] floatValue];
CLLocationCoordinate2D locationco = {latitude,longitude};
NSString *titleString = [tmp objectForKey:@"name"];
Place *pin = [[Place alloc] init];
pin.coordinate = locationco;
pin.title = titleString;
pin.subtitle = @"A Location";
//NSArray *annots = [[NSArray alloc] initWithObjects:pin, nil];
//[map addAnnotations:annots];
[map addAnnotation:pin];
[[map viewForAnnotation:pin] setCanShowCallout:YES];
}
El MKAnnotation
's se muestran en el mapa bien, y puede seleccionarlos, sin embargo hay aparece una burbuja de llamada. Yo sé que ellos están siendo seleccionados adecuadamente formar esta
-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
[view setCanShowCallout:YES];
NSLog(@"Title:%@",[view.annotation description]);
}
Pero eso se limita a imprimir
Title:(null)
estoy usando ARC, y tengo las propiedades establecidas en mi lugar objeto como tal :
@property (nonatomic) CLLocationCoordinate2D coordinate;
@property (nonatomic,readwrite, copy) NSString *title;
@property (nonatomic,readwrite, copy) NSString *subtitle;
¿Qué estoy haciendo mal/falta? Gracias.
Antes de la línea 'addAnnotation', ¿puedes NSLog' pin.title' y ver qué muestra? Además, en el objeto Place, anulaste el método 'description' por casualidad y, de ser así, ¿qué código hay allí? – Anna
El 'NSLog (@"% @ ", pin.title);' Solo devuelve '(nulo)'. No entiendo por qué sin embargo. –