简体   繁体   English

iOS Mapbox自定义标记将不会出现

[英]iOS Mapbox Custom Marker Will Not Appear

Custom Marker Image will not appear only default marker appears in it's place. 自定义标记图像将不会出现,只有默认标记会出现在该位置。

In ViewWillAppear: 在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;
}

Check the docs and don't use RMPointAnnotation . 检查文档,不要使用RMPointAnnotation

If you wish to customize the layer appearance in more detail, you should instead create an RMAnnotation and configure its layer directly. 如果希望更详细地自定义图层外观,则应创建一个RMAnnotation并直接配置其图层。 Providing a layer manually for instances of RMPointAnnotation will not have any effect. 手动为RMPointAnnotation实例提供一个层不会有任何效果。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM