作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经在我的应用中实现了 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];
最佳答案
表达式已替换 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/
我尝试做: var cards = [MGLPolygonFeature]() for card in cardsArray { let polygon = MGLPolygonFeature
我已经在我的应用中实现了 MAPBOX。我在自定义多段线颜色和宽度时遇到问题。这是我已经实现的代码。 MGLPolyline *polylineFirst = [MGLPolyline polylin
我是一名优秀的程序员,十分优秀!