Currently, I know how to create a MKAnnotationView with a static pin, an image that's added.
Does anyone know, or have any resources, on how to create a pin that would change colors or have a number displayed inside of it that would change depending on information about the business?
For instance, I would like to have a pin be red when the business is closed, and green when the business is open. Maybe even a dollar signs inside of the pin to tell the user how expensive it is.
EDIT
I have created a class called CustomPin
that adopts the MKAnnotation
protocol. Additionally, I'm not looking to have a custom MKAnnotationView
image that can change. Does that mean I'll have to add multiple images for the MKAnnotationView
in an array and have it change the image everytime the details about the business change?
Thank you in advance!
You can create custom
MKAnnotationView
by simply inheritance. You can use this class to create annotation view from delegate method.Here is one example.
You have to do this programmatically. Following code may help you: Initialize the pin and give it a type, such as opened, closed, expensive etc.
In your (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation method put a simple check