You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had some problems with a part of my annotations that are disappearing when i zoom in. The viewForAnnotation delegate was no longer called for this annotations and when i zoom out they appear again.
In my application that contents annotations in portugal, Spain, Italy, Swizerland, Germany and Greek this only happens for the annotations in portugal. It seems that filterAnnotationsForVisibleMap is not working properly for that annotations.
I just replaced the code of that method with the following and now it if working fine for me:
I had some problems with a part of my annotations that are disappearing when i zoom in. The viewForAnnotation delegate was no longer called for this annotations and when i zoom out they appear again.
In my application that contents annotations in portugal, Spain, Italy, Swizerland, Germany and Greek this only happens for the annotations in portugal. It seems that filterAnnotationsForVisibleMap is not working properly for that annotations.
I just replaced the code of that method with the following and now it if working fine for me:
(NSArray *)filterAnnotationsForVisibleMap:(NSArray *)annotationsToFilter
{
NSMutableArray *filteredAnnotations = [[NSMutableArray alloc] initWithCapacity:[annotationsToFilter count]];
MKCoordinateRegion self_region = self.region;
for (id annotation in annotationsToFilter)
{
// if annotation is not inside the coordinates, kick it
if([annotation coordinate].latitude > (self_region.center.latitude - self_region.span.latitudeDelta/2.0) &&
[annotation coordinate].latitude < (self_region.center.latitude + self_region.span.latitudeDelta/2.0) &&
[annotation coordinate].longitude > (self_region.center.longitude - self_region.span.longitudeDelta/2.0) &&
[annotation coordinate].longitude < (self_region.center.longitude + self_region.span.longitudeDelta/2.0)) {
[filteredAnnotations addObject:annotation];
}
}
return filteredAnnotations;
}
The text was updated successfully, but these errors were encountered: