2

I want to be able to display a bluish bubble(default one is black) for callout for an annotation.

Wherever I search I only get samples to implement viewForAnnotation delegate method, but that only changes the annotationView not the bubble at the top.

However I wanted the pinColor to be green so I did override this method and here is the code. Can I do something else to provide a backgroundImage for callOut or change the tintColor for it ?

-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
    MKPinAnnotationView *annView=[[[MKPinAnnotationView alloc]
                                  initWithAnnotation:annotation reuseIdentifier:@"pin"] autorelease];
    annView.pinColor = MKPinAnnotationColorGreen;
    [annView setEnabled:YES];
    [annView setCanShowCallout:YES];

    return annView;

}

Here is how it looks right now:

enter image description here

Here is how I want to make it look like:

enter image description here

Amogh Talpallikar
  • 12,084
  • 13
  • 79
  • 135

2 Answers2

3

On iOS7, you can use the tintColor property on the mapView to change the color of the disclosurebutton.

Rick Pastoor
  • 3,625
  • 1
  • 21
  • 24
  • This is a great answer for those who have issues only with ios7 custom buttons that don't show up because of the custom colour of the bubble. But the answer marked as correct fits better to the question! – arniotaki Apr 01 '14 at 11:40
1

You can use custom annotation, as described at http://blog.asynchrony.com/2010/09/building-custom-map-annotation-callouts-part-2/

Dunes Buggy
  • 1,779
  • 1
  • 21
  • 41
  • Yeah I have downloaded the sample already and I am looking at it. but the thing is it shows another annotationView for the Other annotationView right? – Amogh Talpallikar Jul 10 '13 at 13:36
  • The idea is to show another annotation view instead of you callout bubble, but still looks like a callout. In that sense yes. I found the library quite good (fast, and efficient). – Dunes Buggy Jul 10 '13 at 13:38
  • The sample shows an image on it. but the background is black-grey. Can I change the background color? – Amogh Talpallikar Jul 10 '13 at 13:41
  • Yes you can. If you have a close look at the library, you will understand that it provides you a custom view, which you can easily set its background clear colour. Then you can add your custom view to that view. I will suggest you not to use the default callout (although you want to change the colour). You can make a better view :) – Dunes Buggy Jul 10 '13 at 13:44