在 swift 中的 googlemaps 图层上方添加图层
Add layer above googlemaps layer in swift
我尝试通过 google 地图文档中的代码在 google 地图上添加自己的图层:
extension MapViewController {
func addTiles() {
// Implement GMSTileURLConstructor
// Returns a Tile based on the x,y,zoom coordinates, and the requested floor
let urls = { (x: UInt, y: UInt, zoom: UInt) -> NSURL in
let url = "http://example.pl/ras/\(zoom)/\(x),\(y).v\(1).png";
return NSURL(string: url)!
}
// Create the GMSTileLayer
let layer = GMSURLTileLayer(URLConstructor: urls)
layer.tileSize = 512
layer.map = mapView
}}
我得到了这样的东西:
我没有看到应该在我的图块下方的地形。我的瓷砖是透明的。你知道哪里出了问题吗?
更新:
问题只发生在 iOS 模拟器上。它在真实设备上运行。
问题只出现在 iOS 模拟器上。它在真实设备上运行。
我尝试通过 google 地图文档中的代码在 google 地图上添加自己的图层:
extension MapViewController {
func addTiles() {
// Implement GMSTileURLConstructor
// Returns a Tile based on the x,y,zoom coordinates, and the requested floor
let urls = { (x: UInt, y: UInt, zoom: UInt) -> NSURL in
let url = "http://example.pl/ras/\(zoom)/\(x),\(y).v\(1).png";
return NSURL(string: url)!
}
// Create the GMSTileLayer
let layer = GMSURLTileLayer(URLConstructor: urls)
layer.tileSize = 512
layer.map = mapView
}}
我得到了这样的东西:
我没有看到应该在我的图块下方的地形。我的瓷砖是透明的。你知道哪里出了问题吗?
更新: 问题只发生在 iOS 模拟器上。它在真实设备上运行。
问题只出现在 iOS 模拟器上。它在真实设备上运行。