使用GMS进行Swift Map样式设计

Vic*_*tor 3 styles ios gmsmapview swift

我正在使用GMS(Google Maps SDK)在我当前的项目中,它看起来像这样

style地图可能是这样的吗?并仍然使用GMS.

小智 5

您可以按照自己的方式自定义地图:https://mapstyle.withgoogle.com/

完成自定义后,复制json并将项目添加到文件中,如style.json

然后将此样式指定给地图:

do {
            // Set the map style by passing the URL of the local file.
            if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") {
                mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)

            } else {
                NSLog("Unable to find style.json")
            }
        } catch {
            NSLog("One or more of the map styles failed to load. \(error)")
        } 
Run Code Online (Sandbox Code Playgroud)