views:

83

answers:

1

Hi,

After 2 hours of googling I couldn't find an answer so this is my last shot.

I would like to use a custom annotation for the user current location on a mkmapview. But I also want to have the blue accuracy circle around it.

Can this be done?

If not, can I add a call-out to the default blue dot with circle?

The reason that I need this is because on my app, the current location dot often disappears under other annotations. So that's why I use a purple pin with a call-out as current location.

Here is my code for the annotation:

if ([annotation isKindOfClass:MKUserLocation.class]) 
    {
        MKPinAnnotationView *userAnnotationView = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:@"UserLocation"];
        if (userAnnotationView == nil)  {
            userAnnotationView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"UserLocation"]autorelease];
        }            
        else 
            userAnnotationView.annotation = annotation;

        userAnnotationView.enabled = YES;
        userAnnotationView.animatesDrop = NO;
        userAnnotationView.pinColor = MKPinAnnotationColorPurple;
        userAnnotationView.canShowCallout = YES;
        [self performSelector:@selector(openCallout:) withObject:annotation afterDelay:0.01];

        return userAnnotationView;  
    }

Thanks for any advise. Cheers, Christian

A: 

OK, so I ended up deleting the custom notification but adding a call out that pops up automatically. Like this:

    mapView.showsUserLocation=TRUE;
mapView.userLocation.title = NSLocalizedString (@"Here am I",@"Here am I" );
[self performSelector:@selector(openCallout:) withObject:mapView.userLocation afterDelay:3.0];

and:

- (void)openCallout:(id<MKAnnotation>)annotation {
[mapView selectAnnotation:annotation animated:YES];}

Without the delay the call-out will not show up.

Chrizzz