Map Annotations (iOS)

This article describes how to use the iOS SDK to show annotations, or placemarks, on a map.

Map Annotations

MRMapView will always annotate a map with its placemarks, provided you haven't set showsPlacemarks = NO. Similar to Apple's MapKit, the Meridian SDK defines the MRAnnotation protocol for map annotations and the MRMapViewDelegate protocol provides a callback to customize the appearance of map annotations.

You can adopt the MRAnnotation protocol in your own model objects to add them to your maps and you can provide your own views to represent instances of MRPlacemark.

Alternately, you can provide your own objects by overriding mapView:viewForAnnotation: and returning instances of your own subclass of MRAnnotationView.

In the following example, we have a custom view to represent placemarks named "Cafe":

    // In the custom view controller that adopts the MRMapViewDelegate protocol,
    // don't forget to set your controller as the delegate of the MRMapView.

    - (MRAnnotationView *)mapView:(MRMapView *)mapView viewForAnnotation:(id 
  )annotation {

        if ([annotation isKindOfClass:[MRPlacemark class]]) {
            if ([annotation.title isEqualToString:@"Cafe"]) {
                // Assume we've subclassed MRAnnotationView as CafeAnnotationView
                CafeAnnotationView *view = [mapView dequeueReusableAnnotationViewWithIdentifier:@"CafeMarker"];
                if (view == nil)
                    view = [[CafeAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"CafeMarker"];

                return view;

        // Returning nil will allow the default view to be used if the annotation is an instance of MRPlacemark
        return nil;


Tapping an annotation will bring up a bottom sheet in the style of Apple Maps.