jkd359
jkd359

Reputation: 161

iOS Mapbox Custom Marker Will Not Appear

Custom Marker Image will not appear only default marker appears in it's place.

In ViewWillAppear:

RMPointAnnotation *annotation3 = [[RMPointAnnotation alloc] initWithMapView:parkMap coordinate:coordinate andTitle:title];
[parkMap addAnnotation:annotation3];

- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
{
    if (annotation.isUserLocationAnnotation)
        return nil;

    RMMarker *marker;

        marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"square_small.png"]];

    marker.canShowCallout = YES;

    return marker;
}

Upvotes: 1

Views: 569

Answers (1)

incanus
incanus

Reputation: 5128

Check the docs and don't use RMPointAnnotation.

If you wish to customize the layer appearance in more detail, you should instead create an RMAnnotation and configure its layer directly. Providing a layer manually for instances of RMPointAnnotation will not have any effect.

https://github.com/mapbox/mapbox-ios-sdk/blob/509fa7df46ebd654d130ab2f530a8e380bf2bd59/MapView/Map/RMPointAnnotation.h#L33

Upvotes: 1

Related Questions