ios - 无法使用iOS Swift在Google map 上加载自定义图 block

标签 ios swift google-maps overlay gmsgroundoverlay

我正在尝试使用自定义图块作为Google地图的叠加层。
https://tile.example.com/hot/ {z} / {x} / {y} .png”
我使用了“ GMSTileURLConstructor”,但无法在移动应用程序上加载地图。我似乎无法在网上找到任何东西。提前致谢。

我用了以下几行。

class ViewController: UIViewController, GMSMapViewDelegate{

    let urls: GMSTileURLConstructor = {z,x,y in
       let url = "https://tile.example.com/hot/{z}/{x}/{y}.png"
       print(url)
       return URL(string: url)
   }

最佳答案

语法应为

let urls: GMSTileURLConstructor = {z,x,y in
   let url = "https://tile.example.com/hot\(z)_\(x)_\(y).png"
   print(url)
   return URL(string: url)


}

根据Add a Tile Layer文档。

关于ios - 无法使用iOS Swift在Google map 上加载自定义图 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58606218/

相关文章:

ios - 无法在 iOS 中使用 dispatch_async 方法更新 UILabel

javascript - 信息框内的文本区域焦点/事件传播问题

android - Geocoder 不适用于某些 Android 手机

ios - 无法从内存堆栈中释放手势识别器

ios - 将对象移动到特定区域

ios - 如何在 Xcode 中将声音文件添加到您的包中?

ios - 从全屏视频返回后导航工具栏垂直延伸

ios - IQKeyboardManager 错误 : Value of type 'UIView' has no member 'keyboardToolbar'

iOS 交换颜色以更改应用程序的主题

javascript - 多边形内的点——json还是kml?