1

我有一组 x,y 位置点。我不知道如何使用它,因为它不长/纬度。

例如: X=217338 , Y=703099

我想知道如何在 iphone SDK 上使用它以及使用哪个框架?

提前致谢!

4

2 回答 2

2

首先,您需要知道您的值的格式。
如果它们不是 lon/lat,它们可以是米或英寸或半臂长,甚至是标准化的甜甜圈孔。

无论如何,您都需要提出一种转换方法,因为MKMapKit只了解地理坐标(经度/纬度)。

如果您已经澄清您应该查看苹果的位置感知指南。还有一些其他很好的 mapkit 资源,例如raywenderlich.com

于 2012-11-20T20:43:48.463 回答
0

在不知道这些值代表什么的情况下,您实际上无法用它们做任何事情。假设您可以将它们转换为纬度/经度值,这就是您能够以 (X, Y) 坐标为中心的方式:

//Import the <MapKit/MapKit.h> and <CoreLocation/CoreLocation.h> framework 
//and then this will go in your implementation file:
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(xConvertedToLat, yConvertedToLong);
//Set the region your map will display centered on the above coord and spanning 250m on x-axis and 250 on y-axis
MKCoordinateRegion region = MKCoordinateRegionMake(coord, 250, 250);
//You should have a MKMapView object
[myMapView setRegion:region animated:YES];

您可以对数组中的每个对象进行迭代,但在设置最后一个 (x, y) 坐标之前,您不会看到任何内容。

于 2012-11-20T21:58:05.537 回答