我在我的 map View 上画了一堆标记。 所有对象的位置信息(纬度和经度)都存储在一个数组中。 为了优化性能,我不想绘制 ALL 标记。我只想在我目前看到的区域分配标记。但我从 Route Me API 获得的关于位置/屏幕的唯一信息是:
center.latitude;
center.longitude;
但是这个值只返回我整个 map 的中心,我想看到实际 View 的中心位置(纬度和经度)。我也可以获取 GPS 位置,但不能获取屏幕的中心位置。您认为有一种简单的方法可以获取这些信息吗?
这是我实现的一部分:
UIImage* object = [UIImage imageNamed:@"object.png"];
CLLocationCoordinate2D buoyLocation;
NSString* templatString;
NSString* templongString;
for (int i =0; i<(myArray.count); i=i+2)
{
templongString = [myArray objectAtIndex:i];
templatString = [myarray objectAtIndex:i+1];
objectLocation.latitude = [templatString floatValue];
objectLocation.longitude = [templongString floatValue];
myMarker = [[RMMarker alloc] initWithUIImage:object anchorPoint:CGPointMake(xspec, yspec)]; //0.5 1.0
[markerManager1 addMarker:myMarker AtLatLong:objectLocation];
}
最佳答案
关于objective-c - 路由我 : Location & Screen Position,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7091208/