Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Location #10

Open
demoend opened this issue Nov 16, 2012 · 2 comments
Open

User Location #10

demoend opened this issue Nov 16, 2012 · 2 comments

Comments

@demoend
Copy link

demoend commented Nov 16, 2012

When I turn on the user location

[m_MapView setShowsUserLocation:true];

Then I pinch to zoom in or out, the user location reanimates it's self as if It was just turned on for the first time. Rather annoying.

So, If I modify REVClusterMap so the MKUserLocaiton is not removed from the annotation collection as such...

- (void) mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{

if( [self mapViewDidZoom] )
    {
        //[super removeAnnotations:self.annotations];
        //self.showsUserLocation = self.showsUserLocation;


        //Make sure we remove all the annotations first, except the user location
        for (int i =0; i < [self.annotations count]; i++) 
        { 
            if (![[self.annotations objectAtIndex:i] isKindOfClass:[MKUserLocation class]]) 
            {                      
                [self removeAnnotation:[self.annotations objectAtIndex:i]]; 
            } 
        }
    }

//...rest of the code...
}

Then the user location does not reanimate it's self. Great!! However, the clustering has strange artifacts.
Sometimes I see clusters on top of other clusters. And the number of pins and clusters do not always add up. If I undo my changes then the strange artifacts go away.

Is there another way NOT to reanimate the user location each time the zoom is changed?
Or, if you try the code above, did you happen to solve the strange artifacts that show up?

Thanks,
Brian.

@ghost
Copy link

ghost commented Dec 7, 2012

I incoming to the same issue..
I am keeping my user location in the same way,
Also, spot the strange thing is that sometime annotation jump in the cluster and jump out after "zoom in"

looking for solution for keeping the user location...

Thanks,
David

@wayn
Copy link

wayn commented Dec 29, 2012

same issue..
i do like this:

if( [self mapViewDidZoom] )
{
    [super removeAnnotations:[self.annotations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"!(self isKindOfClass: %@)", [MKUserLocation class]]]];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants