我是 iPhone 的新手,但遇到了问题。
我有这个代码
for (int i=0; i<2; i++) {
Datos *datos = (Datos *)[arr_datos objectAtIndex:i];
CLLocationCoordinate2D coord;
AnnotationItem *annotationItem = [[AnnotationItem alloc] init];
coord.latitude =[datos.latitud doubleValue];
coord.longitude = [datos.longitud doubleValue];
NSLog(@"coord %f",coord.longitude);
NSLog(@"coord %f",coord.latitude);
[annotationItem setCoordinate:coord];
//[annotationItem setEstacion:estacion];
[mapView_ addAnnotation:annotationItem];
[annotationItem release];
}
什么都没做的问题
但如果我更改 coord.latitude=40.444
和 coord.longitude=-3.700;
这给了我想要的,但我不想要这个,因为我有一个包含许多纬度和经度的数组。谁能帮我这个?当我输入 coord.longitude=[datos.longitude floatValue];
时,它不起作用?
我正在使用 Xcode 3.2.2
谢谢,请原谅我的英语。
最佳答案
问题是我更改了值,我输入了错误的值。我唯一要做的就是改变
coord.latitude =[datos.longitud doubleValue];
coord.longitude = [datos.latitud doubleValue];
感谢大家的宝贵时间。
关于Iphone CLLocationCoordinate2D,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4325960/