Iphone CLLocationCoordinate2D

标签 iphone objective-c ios

我是 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.444coord.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/

相关文章:

iphone - 我的表示层与我的模型层不匹配,即使我没有动画

iphone nsarray问题?

ios - 类似于 iPhone 中的 HashSet

iOS Xcode 6 LaunchImage The launch image set named "LaunchImage"没有任何适用的内容

ios - Swift 中的 NSNotificationCenter addObserver

ios - 从xcode 8和Application Loader上传的应用程序,但在iTunes连接中不可见

ios - SIGSEGV/SEGV_ACCERR 导致 GPUImage 框架 iOS 崩溃

ios - 使用安全框架在 Objective-C 中以编程方式创建 x509 证书

ios - 单击 CollectionViewCell 显示先前选择的单元格而不是当前单元格

c# - 将带有 QueryString 的 URL 传递给 UIWebView