我在我的地图视图上画了一堆标记。所有对象的位置信息(纬度和经度)都存储在一个数组中。为了优化性能,我不想绘制所有标记。我只想在我目前看到的区域分配标记。但我从 Route Me API 获得的关于位置/屏幕的唯一信息是:
center.latitude;
center.longitude;
但是这个值只返回我整个地图的中心,我想查看实际视图的中心位置(纬度和经度)。我也能得到 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];
         }