[英]How to create a CLLocationCoordinate2d object
I am trying to to call MKPolylines' + polylineWithCoordinates:count:
method. 我试图调用MKPolylines
+ polylineWithCoordinates:count:
方法。
How can I create a CLLocationCoordinate2D * object in this case. 在这种情况下,如何创建CLLocationCoordinate2D *对象。 I have gone through this particular answer in CLLocationCoordinate2D without knowing how many will be in the array?
我在CLLocationCoordinate2D中经历了这个特定的答案, 却不知道数组中会有多少个?
// unpacking an array of NSValues into memory
CLLocationCoordinate2D *points = malloc([mutablePoints count] * sizeof(CLLocationCoordinate2D));
for(int i = 0; i < [mutablePoints count]; i++) {
[[mutablePoints objectAtIndex:i] getValue:(points + i)];
}
MKPolyline *myPolyline = [MKPolyline polylineWithCoordinates:points count:[mutablePoints count]];
free(points);
What kind of entries are in the array mutablePoints in the above case? 在上述情况下,数组mutablePoints中有哪些条目?
CLLocationCoordinate2D coordinate;
for (int i = 0; i < arr.count; i++)
{
float t1 = [[arr objectAtIndex:1] floatValue];
float t2 = [[arr objectAtIndex:0] floatValue];
coordinate.latitude = t1;
coordinate.longitude = t2;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.