如何在iPhone中滚动Map时跟踪地图区域

时间:2012-03-16 10:37:37

标签: iphone ios google-maps

我已完成将地图视图显示到iPhone中的当前位置,并最大化缩放级别。

但现在我想跟踪地图视图中的任何滚动以获取其可见区域。

是否有任何事件要做,如果是,那么如何??

如果没有,怎么可能?

1 个答案:

答案 0 :(得分:1)

是的,可以通过mapView的委托。

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{
    // This method is called whenever the currently displayed map region changes. 
    // During scrolling, this method may be called many times to report updates to the map position. 
    // Therefore, your implementation of this method should be as lightweight as possible to avoid affecting scrolling performance. 
   // *Straight from Apple's documentation

   MKMapRect visibleRect = [mapView visibleMapRect];
}