在我的应用程序中使用地图视图时,有时 MKMapKit 委托方法“mapView:regionDidChange”不调用。它仅在我拖动地图时发生。但是当我放大或缩小时它工作得很好。因此,它会在拖动地图时创建与在地图上放置新注释相关的问题。我已经在mapView:regionDidChange:
int j=0;
-(void) mapView:(MKMapView *)mapsView regionDidChangeAnimated:(BOOL)animated{
zoomLevel = self.mapView.region.span.latitudeDelta;
if (![appDelegate internetConnected]){
return;
}
if (appDelegate.isMapViewRegionChanged) {
if (j==0) {
j++;
return;
}else{
j=0;
appDelegate.isMapViewRegionChanged = FALSE;
return;
}
}
[self callGetMapViewWithObject:nil];
}
/*
first boolean is to check Internet connection.
[appDelegate internetConnected]
Second condition is to return when we navigate from any view controller too map View controller.
appDelegate.isMapViewRegionChanged
Third is a method to place new annotations.
[self callGetMapViewWithObject:nil];
*/
我检查了所有条件和布尔值,但我的编码不是这个错误的原因。所以可能是它与地区有关,确实改变了方法。
因此,在将我的应用程序与地图一起使用时,20% 的时间它的行为类似于 Ideal(方法不调用)。
有人可以帮我解决这个问题。
先感谢您。