Mapbox iOS GL 黑色背景图层问题

Mapbox iOS GL black background layer issue

我尝试在 mapbox-iOS-SDK gl 3.2.3

中实现光栅图块

这是我的本地风格来源:

{
"version": 8,
"name": "2GIS tiles",
"sources": {
    "mainSource": {
        "type": "raster",
        "tiles": [
                  "http://tile1.maps.2gis.com/tiles?x={x}&y={y}&z={z}&v=1"
                  ],
        "tileSize": 128
    }
},
"layers": [
           {
           "id": "background",
           "type": "background",
           "paint": {
               "fill-color": "#FFF9E8"
           }
           },
           {
           "id": "mainLayer",
           "type": "raster",
           "source": "mainSource",
           "paint": {
               "raster-fade-duration": 100
           }
           }
           ]
}

这是我得到的 click-me

因此,在滚动或平移地图时 - 加载图块时有时会出现黑色背景。

我该如何解决这个问题?是否可以更改黑色?

尝试将 paint 属性 从 fill-color 更改为 background-color

例如,

{
  "id": "background",
  "type": "background",
  "paint": {
    "background-color": "#FFF9E8"
  }
}

Mapbox GL Style Referencepaint 提到了这一点,这应该可以解释您看到的黑色背景。

background-color
Optional color. Defaults to #000000. Disabled by background-pattern. The color with which the background will be drawn.