gpt4 book ai didi

ios - 从 NSExpression 分配给 MGLStyleValue 的不兼容指针类型

转载 作者:行者123 更新时间:2023-11-28 20:59:02 26 4
gpt4 key购买 nike

我已经在我的应用中实现了 MAPBOX。我在自定义多段线颜色和宽度时遇到问题。这是我已经实现的代码。

MGLPolyline *polylineFirst = [MGLPolyline polylineWithCoordinates:routeCoordinates count:routeFirst.coordinateCount];

MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"polyline" shape:polyline options:nil];
MGLLineStyleLayer *lineStyle = [[MGLLineStyleLayer alloc] initWithIdentifier:@"polyline" source:source];

lineStyle.lineColor = [NSExpression expressionForConstantValue:[UIColor yellowColor]];
lineStyle.lineWidth = [NSExpression expressionForConstantValue:@5];

[self.mapView.style addSource:source];
[self.mapView.style addLayer:lineStyle];

enter image description here

最佳答案

表达式已替换 style functions在 v4.0 中,看起来您使用的是早期版本的 Maps SDK。

与您的代码等效的样式函数是:

   lineStyle.lineColor = [MGLStyleValue valueWithRawValue:[UIColor yellowColor]];
lineStyle.lineWidth = [MGLStyleValue valueWithRawValue:@5];

您可能会发现 this sample code有帮助。

关于ios - 从 NSExpression 分配给 MGLStyleValue 的不兼容指针类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50740874/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com