ios - 检测 MKMapView 何时停止移动
<p><p>每当用户移动我的 MKMapView 时,我都会在 map 上加载更多图钉。现在,我正在使用这段代码来检测他们何时拖动它:</p>
<pre><code>- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
- (void)didDragMap:(UIGestureRecognizer*)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateEnded){
CLLocationCoordinate2D topLeft, bottomRight;
topLeft = ;
CGPoint pointBottomRight = CGPointMake(self.mapView.frame.size.width, self.mapView.frame.size.height);
bottomRight = ;
;
}
}
</code></pre>
<p>但是,这只检测用户何时停止拖动。用户可以“ throw ” map ,并且在他们完成“拖动”后 map 仍然可以移动。有什么方法可以找到 map 停止移动的时间吗?谢谢</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个委托(delegate):</p>
<p> <a href="https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapViewDelegate_Protocol/#//apple_ref/occ/intfm/MKMapViewDelegate/mapView:regionDidChangeAnimated:" rel="noreferrer noopener nofollow">mapView:regionDidChangeAnimated:</a> </p></p>
<p style="font-size: 20px;">关于ios - 检测 MKMapView 何时停止移动,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32389078/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32389078/
</a>
</p>
页:
[1]