自定义框架到注释视图mapbox无法正常工作

时间:2015-11-19 07:01:59

标签: ios annotations mapbox

我正在使用mapbox并为其添加自定义注释视图。但不知何故,注释视图的高度没有反映出来。

这是代码。

- (void)viewDidLoad {
[super viewDidLoad];

MGLMapView *mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds];
mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

MGLPointAnnotation *point = [[MGLPointAnnotation alloc] init];
point.coordinate = CLLocationCoordinate2DMake(38.894368, -77.036487);
point.title = @"Hello world!";
point.subtitle = @"Welcome to The Ellipse.";

mapView.delegate = self;

[mapView setCenterCoordinate:point.coordinate zoomLevel:12 animated:NO];
[mapView addAnnotation:point];
[self.view addSubview:mapView];
// Do any additional setup after loading the view, typically from a nib.
}

-(UIView *)mapView:(MGLMapView *)mapView   leftCalloutAccessoryViewForAnnotation:(id<MGLAnnotation>)annotation
{
customAnnotationView *view = [[[NSBundle mainBundle] loadNibNamed:@"customAnnotationView" owner:self options:nil] objectAtIndex:0];
[view setFrame:CGRectMake(0, 0, 260, 100)];
return view;
}

此处视图的高度未反映在地图上。

1 个答案:

答案 0 :(得分:0)

Mapbox iOS SDK用于提供注释标注的SMCalloutView不会根据其子视图的高度动态调整大小。 (至少,它没有默认情况下Mapbox如何配置SMCalloutView。)

更多的标注视图自定义即将到来with v3.1.0

mapView:calloutViewForAnnotation:MGLCalloutView将允许您完全自定义外观。