Google 地图 iOS SDK GMSURLTileLayer 显示不正确 color/transparency

Google Maps iOS SDK GMSURLTileLayer displaying incorrect color/transparency

PNG 瓷砖在 iOS 上显示不正确的颜色和透明度。透明区域显示为半透明的白色。相同的图块集在 Android 和 Web 浏览器上正确显示,所以我认为这不是图块本身的问题。这是我的 Swift 代码:

class ViewController: UIViewController {
    @IBOutlet weak var mapView: GMSMapView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let camera = GMSCameraPosition.camera(withLatitude: 30.00, longitude: -90, zoom: 7.0)
        let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
        view = mapView
                                
        // Implement GMSTileURLConstructor
        let urls: GMSTileURLConstructor = { (x, y, zoom) in
          let url = "https://aerocast.s3.amazonaws.com/radar/klix/lixtileskml/\(zoom)/\(x)/\(y).png"
          return URL(string: url)
        }

        let tilelayer = GMSURLTileLayer(urlConstructor: urls)
        
        tilelayer.zIndex = 100
        tilelayer.map = mapView
        tilelayer.opacity = 1.0
    
                  }
}

我一直在寻找调整 tilelayer 颜色属性的方法,但一直找不到任何方法。

我认为视图层次结构存在一些问题

class ViewController: UIViewController {
    @IBOutlet weak var mapView: GMSMapView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let camera = GMSCameraPosition.camera(withLatitude: 30.00, longitude: -90, zoom: 7.0)
        self.mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
        self.view.addSubview(mapView)
        // Define constraints (i.e position in the parent view), example for full screen ones
        mapView.translatesautoresizingmaskintoconstraints = false
        mapView.topAnchor.constraint(equalToSystemSpacingBelow: view.topAnchor).isActivate = true
        mapView.bottomAnchor.constraint(equalToSystemSpacingBelow: view.bottomAnchor).isActivate = true
        mapView.leftAnchor.constraint(equalToSystemSpacingBelow: view.leftAnchor).isActivate = true
        mapView.rightAnchor.constraint(equalToSystemSpacingBelow: view.rightAnchor).isActivate = true
                                
        // Implement GMSTileURLConstructor
        let urls: GMSTileURLConstructor = { (x, y, zoom) in
          let url = "https://aerocast.s3.amazonaws.com/radar/klix/lixtileskml/\(zoom)/\(x)/\(y).png"
          return URL(string: url)
        }

        let tilelayer = GMSURLTileLayer(urlConstructor: urls)
        
        tilelayer.zIndex = 100
        tilelayer.map = mapView
        tilelayer.opacity = 1.0
    }
}

此问题特定于 xcode 上的 iOS 模拟器。物理 iOS 设备上不存在此问题。我将问题提交给 Google 地图支持,他们能够重现该问题并正在调查。