1

カスタム アノテーションを NSMutableArra に渡して、それを使用してテーブル ビューにデータを入力しようとしています。コードは次のとおりです。

.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 の結果は null です。Perarps MyLocation オブジェクトを可変配列にコピーすることはできませんか?

前もって感謝します。

4

1 に答える 1

1

これを最初に viewDidLoad または他のメソッドで呼び出して、配列を初期化します。

_mapViewAnnotations = [NSMutableArray array];
于 2013-04-22T19:06:16.050 に答える