确定是否拖动/移动了MKMapView [英] determine if MKMapView was dragged/moved
本文介绍了确定是否拖动/移动了MKMapView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法确定是否拖动了MKMapView?
Is there a way to determine if a MKMapView was dragged around?
我希望每次用户使用<$ c $拖动地图时获取中心位置c> CLLocationCoordinate2D center = [locationMap centerCoordinate]; 但是我需要一个委托方法或者一旦用户浏览地图就会触发。
I want to get the center location every time a user drags the map using CLLocationCoordinate2D centre = [locationMap centerCoordinate];
but I'd need a delegate method or something that fires as soon as the user navigates around with the map.
提前致谢
推荐答案
查看 MKMapViewDelegate 参考。
具体来说,这些方法可能很有用:
Specifically, these methods may be useful:
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
确保设置了地图视图的委托属性,以便调用这些方法。
Make sure your map view's delegate property is set so those methods get called.
这篇关于确定是否拖动/移动了MKMapView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文