2012-03-16 64 views
0

我已經在iPhone中使用當前位置以最大化縮放成功設置地圖視圖。如何在iPhone中獲取可見地圖的區域

一樣,

myMapView.showsUserLocation = YES; 

.....

span.latitudeDelta=0.0001; 
span.longitudeDelta=0.0001; 

...

現在我想在任何其中心點獲取地圖的可見部分的完整區域的公里,米,數量等措施

任何幫助..

回答

0

它很容易做到這一點:

MKMapRect visibleRect = [myMapView visibleMapRect]; 

然後有一些功能來測量儀表,如矩形:

CLLocationDistance MKMetersBetweenMapPoints(
    MKMapPoint a, 
    MKMapPoint b 
); 
0

看看DocumentationSample Code

而且嘗試像這樣:

MKCoordinateRegion yourRegion; 
// Take a look at Lisbon Downtown 
yourRegion.center = CLLocationCoordinate2DMake(38.715, -9.140); 
yourRegion.span = MKCoordinateSpanMake(0.02, 0.02); 
[self.mapView setRegion:yourRegion animated:YES]; 
相關問題