Mapkit 多重注释
我无法向我的视图添加多个注释。它只添加一个。这是我的代码。谢谢。
const char *sql1=[final1 UTF8String];
sqlite3_stmt *statement1;
if(sqlite3_prepare_v2(database,sql1,-1,&statement1,NULL)==SQLITE_OK)
{
tableData1=[[NSMutableArray alloc] init];
while (sqlite3_step(statement1) == SQLITE_ROW)
{
l++;
NSLog(@"numar de lapuri%d",l);
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 0)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 1)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 2)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 3)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 4)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 5)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 6)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 7)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 8)]];
NSString* laplat=[tableData1 objectAtIndex:7];
NSString* longlat=[tableData1 objectAtIndex:8];
NSLog(@"lap lat:%@",laplat);
NSLog(@"lap lat:%@",longlat);
lapcoord.latitude=[laplat doubleValue];
lapcoord.longitude=[longlat doubleValue];
annotation=[[AnnotationDelegate alloc] initWithCoordinate:lapcoord];
[mapView addAnnotation:annotation];
[annotation release];
NSLog(@"added");
}
NSLog(@"Works lap");
}
I can't add multiple annotation to my view. It only adds one.Here is my code. Thanks.
const char *sql1=[final1 UTF8String];
sqlite3_stmt *statement1;
if(sqlite3_prepare_v2(database,sql1,-1,&statement1,NULL)==SQLITE_OK)
{
tableData1=[[NSMutableArray alloc] init];
while (sqlite3_step(statement1) == SQLITE_ROW)
{
l++;
NSLog(@"numar de lapuri%d",l);
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 0)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 1)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 2)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 3)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 4)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 5)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 6)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 7)]];
[tableData1 addObject:[NSString stringWithFormat:@"%s",(char*)sqlite3_column_text(statement1, 8)]];
NSString* laplat=[tableData1 objectAtIndex:7];
NSString* longlat=[tableData1 objectAtIndex:8];
NSLog(@"lap lat:%@",laplat);
NSLog(@"lap lat:%@",longlat);
lapcoord.latitude=[laplat doubleValue];
lapcoord.longitude=[longlat doubleValue];
annotation=[[AnnotationDelegate alloc] initWithCoordinate:lapcoord];
[mapView addAnnotation:annotation];
[annotation release];
NSLog(@"added");
}
NSLog(@"Works lap");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须保留一个用于注释的数组并使用
You have to keep an array for the annotations and use