开发者

Mapkit: Pulsating blue dot and circle

Im trying to get the pulsating blue dot and circle when users zoom in to their current location. But its not appearing quite well. I understand that the codes needed to be places in the viewForAnnotation. Here are the relevant codes. Tell me if you need more! Thanks aloot

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{

if ([annotation isKindOfClass:[MKUserLocation class]])
    return nil;  //return nil to use default blue dot view

//NSLog(@"View for Annotation is called");
MKPinAnnotationView *pin=[[MKPinAnnotationView alloc] 
                          initWithAnnotation:annotation reuseIdentifier:nil];
pin.userInteractionEnabled=TRUE;

[pin setPinColor:MKPinAnnotationColorGreen];
pin.canShowCallout = YES;
pin.animatesDrop = YES;

MapEvent* event = (MapEvent*)annotation;
NSLog(@"%@",event.uniqueID);

UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:@selector(clickAnnotation:) forControlEvents:UIControlEventTouchUpInside];
[rightButton setTitle:event.uniqueID forState:UIControlStateNormal];

pin.rightCalloutAccessoryView = rightButton;

return pin;
开发者_如何学Python

}


To show the blue dot with the circle, set the showsUserLocation property of the MKMapView to YES.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜