百度地图所有的大头针一屏显示

//各个点一屏显示-(void)mapViewFitAnnotatiosa:(NSMutableArray*)locations{

if (locations.count < 2) return;

CLLocationCoordinate2D coor ;//= [locations[0] coordinate];

coor.latitude = self.latitue;

coor.longitude = self.longitude;

BMKMapPoint pt = BMKMapPointForCoordinate(coor);

CGFloat ltX, ltY, rbX, rbY;

ltX = pt.x, ltY = pt.y;

rbX = pt.x, rbY = pt.y;

for (int i = 0; i < locations.count; i++) {

CLLocationCoordinate2D coordinate;

BMKPoiInfo* poi = [self.poiResultArray objectAtIndex:i];

coordinate.latitude = poi.pt.latitude;

coordinate.longitude = poi.pt.longitude;

BMKMapPoint pt = BMKMapPointForCoordinate(coordinate);

if (pt.x < ltX) ltX = pt.x;

if (pt.x > rbX) rbX = pt.x;

if (pt.y > ltY) ltY = pt.y;

if (pt.y < rbY) rbY = pt.y;

}

BMKMapRect rect;

rect.origin = BMKMapPointMake(ltX , ltY);

rect.size = BMKMapSizeMake(rbX - ltX, rbY - ltY);

[self.baiDuMapView setVisibleMapRect:rect];

self.baiDuMapView.zoomLevel = self.baiDuMapView.zoomLevel - 0.3;

}

你可能感兴趣的:(百度地图所有的大头针一屏显示)