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

If any annotation pin needs to separate then we can't #17

Open
maxytheravi opened this issue Dec 12, 2013 · 3 comments
Open

If any annotation pin needs to separate then we can't #17

maxytheravi opened this issue Dec 12, 2013 · 3 comments

Comments

@maxytheravi
Copy link

This should we have some flag for pins if we don't want to clustered any any.
This is a part of improvement but we should have this I think.

@guru78
Copy link

guru78 commented Dec 12, 2013

you can separate different pins like this code

annView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"pin"];
if( !annView )
annView = [[MKAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:@"pin"];
if ([pin.accessibilityValue isEqualToString:@"1"])
annView.image = [UIImage imageNamed:@"redpin.png"];
else
annView.image = [UIImage imageNamed:@"bluepin.png"];

@maxytheravi
Copy link
Author

Thanks for your reply to help me. But still I am confuse. Here is my code

/------------------------------------------------------------------/

  • (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation
    {
    if([annotation class] == MKUserLocation.class) {
    //userLocation = annotation;
    return nil;
    }

    REVClusterPin *annotationPin = (REVClusterPin *)annotation;

    MKAnnotationView *annotationView;

    if ([annotationPin nodeCount] > 0) {

    annotationPin.title = @"___";
    
    annotationView = (REVClusterAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:@"cluster"];
    
    if(!annotationView)
        annotationView = (REVClusterAnnotationView*)[[REVClusterAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"cluster"];
    
    annotationView.image = [UIImage imageNamed:@"cluster.png"];
    
    [(REVClusterAnnotationView*)annotationView setClusterText:[NSString stringWithFormat:@"%i",[annotationPin nodeCount]]];
    
    annotationView.canShowCallout = NO;
    

    } else {
    annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"pin"];

    if(!annotationView)
        annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin"];
    
    annotationView.image = [UIImage imageFromBundle:[self getImageForCategory:annotationPin.regionPropertyDataHolderObj withIconFlag:kPinImage]];
    annotationView.canShowCallout = YES;
    annotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];//button;
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 25.0, 25.0)];
    imageView.center = annotationView.leftCalloutAccessoryView .center;
    imageView.image = [UIImage imageFromBundle:[self getImageForCategory:annotationPin.regionPropertyDataHolderObj withIconFlag:kIconImage]];
    annotationView.leftCalloutAccessoryView = imageView;
    
    annotationView.calloutOffset = CGPointMake(-6.0, 0.0);
    

    }
    return annotationView;
    }
    /------------------------------------------------------------------/

Here i have to separate out if "annotationPin" == "self.sourceAnnotationPin" then show that pin always separate from cluster else merge into custer. "self.sourceAnnotationPin" is a pin which i want always tobe separate from cluster. How should I will do that.

@avalanched
Copy link

if you want to add functionality you can always submit a pull request.

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

3 participants