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 am using OCMapViews with a a few annotations that should always be visible. Adding and clustering all work, but when I zoom in or pan the view, the view is reloaded, and then the annotationsToIgnore are gone. Upon a next refresh, they are back. I could locate the issue to the final lines of the doClustering method:
// Clear map but leave UserlcoationNSMutableArray *annotationsToRemove = [[NSMutableArrayalloc] initWithArray:self.displayedAnnotations];
[annotationsToRemove removeObject:self.userLocation];
// add clustered and ignored annotations to map
[superaddAnnotations: clusteredAnnotations];
[superaddAnnotations: [annotationsToIgnore allObjects]];
// fix for flickering
[annotationsToRemove removeObjectsInArray: clusteredAnnotations];
[superremoveAnnotations:annotationsToRemove];
What happens is that upon first view, the annotationsToIgnore are are added to the annotations that are going to be displayed by super. However, upon second view, the annotationsToRemove is loaded with the current visible annotations., including the ones that are to be ignored during clustering. Of course, they are added when [super addAnnotations: [annotationsToIgnore allObjects]]; is executed, but as annotationsToIgnore objects are also in the annotationsToRemove, they are basically added at first but removed at the next line. For the third view, it is basically starting with a clean slate., so the annotationsToIgnore are back
A solution to this to change the order of the last two parts of the code above: first do the remove on super and then add all annotations. There is flickering, though, for the annotationsToIgnore
The text was updated successfully, but these errors were encountered:
Thank you for your contribution!
I've pushed a version with your solution. I'll try to re implement this hole annotation adding once to completely remove the flickering.
hi,
I am using OCMapViews with a a few annotations that should always be visible. Adding and clustering all work, but when I zoom in or pan the view, the view is reloaded, and then the
annotationsToIgnore
are gone. Upon a next refresh, they are back. I could locate the issue to the final lines of thedoClustering
method:What happens is that upon first view, the annotationsToIgnore are are added to the annotations that are going to be displayed by super. However, upon second view, the
annotationsToRemove
is loaded with the current visible annotations., including the ones that are to be ignored during clustering. Of course, they are added when[super addAnnotations: [annotationsToIgnore allObjects]];
is executed, but asannotationsToIgnore
objects are also in theannotationsToRemove
, they are basically added at first but removed at the next line. For the third view, it is basically starting with a clean slate., so theannotationsToIgnore
are backA solution to this to change the order of the last two parts of the code above: first do the remove on super and then add all annotations. There is flickering, though, for the
annotationsToIgnore
The text was updated successfully, but these errors were encountered: