iOSのsqlitedbから入力されたmutablearrayがあります。正しくロードして表示するための注釈を取得しました。私の質問は、配列のサイズで注釈を追加するループをどのように作成できるかです。次のコードを試し、配列の最後のエントリを取得して表示しました
NSMutableArray *annotations=[[NSMutableArray alloc] init];
CLLocationCoordinate2D theCoordinate5;
MyAnnotation* myAnnotation5=[[MyAnnotation alloc] init];
for (int i = 0; i < _getDBInfo.count; i++) {
dbInfo *entity = [_getDBInfo objectAtIndex:i];
NSNumber *numlat=[[NSNumber alloc] initWithDouble:[entity.Latitude doubleValue]];
NSNumber *numlon=[[NSNumber alloc] initWithDouble:[entity.Longitude doubleValue]];
NSLog(@"%d",[_getDBInfo count]);
la=[numlat doubleValue];
lo=[numlon doubleValue];
theCoordinate5.latitude=la;
theCoordinate5.longitude=lo;
myAnnotation5.coordinate=theCoordinate5;
myAnnotation5.title=[NSString stringWithFormat:@"%@"entity.EntityNo];
myAnnotation5.subtitle=[NSString stringWithFormat:@"%@",entity.EntityName];
[mapView addAnnotation:myAnnotation5];
[annotations addObject:myAnnotation5];
}
私の質問は、配列のカウントに基づいてビュー注釈オブジェクトを作成して追加するにはどうすればよいかということだと思います。
どんな助けでも大歓迎です。
私はiOSとプログラミングに不慣れなので、優しくしてください。