Reputation: 1034
I am trying to pass custom annotation to a NSMutableArra in order to use it to populate a table view. The code is:
in .h I define a NSMutableArray *mapViewAnnotations;
then in the .m
- (void)plotBarPosition:(NSString *)datos{
/*
code that extract data froma a json string
*/
MyLocation *nota =[[MyLocation alloc] initWithName:barNamePlusDistance coordinate:coordinate horario:horario oferta:offerta more:info];
NSLog(@"nota :%@",nota);
[_mapView addAnnotation:nota]; //annotation are plot on the map
[mapViewAnnotations addObject:nota];
NSLog(@"mapViewAnnotations:%@",mapViewAnnotations); //NSlog return null
}
mapViewAnnotations results null. Perarps It is not possible to copy MyLocation object into a mutablearray?
Thanks in advance.
Upvotes: 1
Views: 54
Reputation: 9414
Call this first in viewDidLoad or other method to init the array.
_mapViewAnnotations = [NSMutableArray array];
Upvotes: 1