如何将对象的坐标放入 CLLocation 中? (Objective-C、iPhone)
我目前正在使用 http://iphonear.org 移植的 ARKit,循环获取 xml 并绘制屏幕上的坐标。然而,出于某种原因,转换对象值:
for(NSObject *locxml in xmlLocations) {
tempLocation = [[CLLocation alloc]
initWithLatitude: (int)[locxml valueForKey:@"lat"]
longitude: (int)[locxml valueForKey:@"long"]];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
tempCoordinate.title = [locxml valueForKey:@"title"];
[tempLocationArray addObject:tempCoordinate];
[tempLocation release];
[locxml release];
}
只是没有显示任何内容,我已经尝试过
[[locxml valueForKey:@"lat"] doubleValue] ,它确实完全在错误的位置显示了坐标(是的,我确信的这个)。
有关如何将对象的坐标放入 CLLocation 的任何帮助吗?
I'm currently using the ARKit ported by the http://iphonear.org guys, looping through a fetched xml and plotting coordinates on the screen. However for some reason casting the object values:
for(NSObject *locxml in xmlLocations) {
tempLocation = [[CLLocation alloc]
initWithLatitude: (int)[locxml valueForKey:@"lat"]
longitude: (int)[locxml valueForKey:@"long"]];
tempCoordinate = [ARGeoCoordinate coordinateWithLocation:tempLocation];
tempCoordinate.title = [locxml valueForKey:@"title"];
[tempLocationArray addObject:tempCoordinate];
[tempLocation release];
[locxml release];
}
just doesn't show up anything, i have already tried
[[locxml valueForKey:@"lat"] doubleValue] which does indeed shows coordinates just totally in the wrong place (yeah i'm sure of this).
Any help on how to put coordinates from an object into a CLLocation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
nvm 由于某种原因纬度和经度被交换了>。<我现在觉得自己很蠢。
nvm for some reason the lat and longitude got swapped >.< i feel stupid now.