2011-08-17 119 views
1

我在地圖視圖上畫了一堆標記。 有關所有對象位置的信息(經度和緯度)存儲在數組中。 要優化性能,我不想畫全部標記。我只想在我目前看到的區域中分配標記。但我從大約位置/屏幕的路線我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]; 


     } 

回答