Reputation: 1476
In the following method:
- (MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation{
used to display a custom annotation UIImage, I would like to be able to differentiate my annotations (I can have 3 different types).
Ideally, I would like to be able to have a tag
on the MGLAnnotation to easily identify what type of annotation it is, but I can also use a combination of the title, latitude and longitude to do so.
But in the method, I am unable to get the annotation.coordinate
, or annotation.title
.
How come? Can I make this properties accessible?
Upvotes: 1
Views: 152
Reputation: 7936
You can access the coordinate and title of the annotation like this:
NSString *title = [annotation title];
CLLocationCoordinate2D coordinate = [annotation coordinate];
Upvotes: 2