传递自定义注释到NSMutableArray,用来充填tableView中。代码:
在.h文件中定义了一个NSMutableArray *mapViewAnnotations;
然后在.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 为空。是不是不能将对象复制到mutablearray中?谢谢。