【发布时间】:2013-08-01 13:52:42
【问题描述】:
我想同时在地图上显示多个注释。我遇到的问题是我将所有纬度和经度都作为 NSString ...
我想将字符串转换为 duble 以便我可以传递给“CLLocationCoordinate2D”实例.. 但我收到错误消息:指针不能转换为类型“双”
locationCoordinate.latitude=(double)NearbyLocations.lat;
locationCoordinate.latitude=(double)NearbyLocations.lng;
这是我遇到问题的代码的一部分。但是,正如您可能看到的,我还没有完成它。
NSMutableArray *locations= [[NSMutableArray alloc]init];
CLLocationCoordinate2D locationCoordinate;
location *NearbyLocations;
Annotation *annotatedLocations;
//for (int i=0; i < locationOnMap.count;i++) {
annotatedLocations = [[Annotation alloc]init];
locationCoordinate.latitude=(double)NearbyLocations.lat;
locationCoordinate.latitude=(double)NearbyLocations.lng;
annotatedLocations.coordinate=locationCoordinate;
annotatedLocations.title=NearbyLocations.lo_name;
annotatedLocations.subtitle=NearbyLocations.lo_vicinity;
[locations addObject:annotatedLocations];
//}
如何将点类型的字符串转换为双精度
【问题讨论】:
-
您使用哪种语言?
-
Marc,它看起来很像 Objective-C
-
很抱歉,我使用的是 Objective-c !!!完全忘了说!
标签: objective-c pointers casting double