iOS Google Maps SDK-隐藏/删除标签 [英] iOS Google Maps SDK - Hide / remove labels
问题描述
我在我的iOS项目中使用Google Maps SDK.我正在使用Swift,并且我想在UIView中显示Google地图,而没有任何文本或标签.我能够正确显示地图,但无法从地图中删除文本...我在Javascript中看到了相同的问题,但是无法在Swift中复制它(如何得到没有标签的地图?)...我想要地图的常规类型(kGMSTypeNormal).有什么方法可以做到吗?
I am using Google Maps SDK in my iOS project. I am using Swift and I want to display the Google Map in UIView without any text or labels. I am able to display the map correctly but I am not able to remove the text from the map... I saw the same problem in Javascript but was unable to replicate it in Swift (How to get a map without labels?)... I want the regular type of the map (kGMSTypeNormal). Is there some way how to do it?
推荐答案
可以隐藏标签
,地标
和道路
./p>
do {
// Set the map style by passing the URL of the local file.
if let styleURL = Bundle.main.url(forResource: "mapStyle", withExtension: "json") {
self.mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
} else {
print("Unable to find style.json")
}
} catch {
print("One or more of the map styles failed to load. \(error)")
}
其中 mapStyle.json 是我项目中的json文件.有关更多详细信息,请参见 Google文档.
Where mapStyle.json is a json file in my project. For more detail see Google documentation.
这篇关于iOS Google Maps SDK-隐藏/删除标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!