gpt4 book ai didi

ios - 检测 MKMapView 何时停止移动

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:12:49 25 4
gpt4 key购买 nike

每当用户移动我的 MKMapView 时,我都会在 map 上加载更多图钉。现在,我正在使用这段代码来检测他们何时拖动它:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}

- (void)didDragMap:(UIGestureRecognizer*)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateEnded){
CLLocationCoordinate2D topLeft, bottomRight;
topLeft = [self.mapView convertPoint:CGPointMake(0, 0) toCoordinateFromView:self.mapView];
CGPoint pointBottomRight = CGPointMake(self.mapView.frame.size.width, self.mapView.frame.size.height);
bottomRight = [self.mapView convertPoint:pointBottomRight toCoordinateFromView:self.mapView];

[self loadMorePlaces:topLeft bottomRight:bottomRight];
}
}

但是,这只会检测用户何时停止拖动。用户可以“甩动” map , map 在完成“拖动”后仍然可以移动。有什么办法可以找到 map 停止移动的时间吗?谢谢

最佳答案

试试这个委托(delegate):

mapView:regionDidChangeAnimated:

关于ios - 检测 MKMapView 何时停止移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32389078/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com