本文介绍了“达到纹理图集的最大数量,无法分配更多"使用谷歌地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个使用Google Maps和大量叠加层的应用程序,当我尝试加载大量叠加层时,它似乎停滞并向我提供((null))为假:已达到纹理图集的最大数量,无法分配更多."

I'm building an app which uses Google Maps, and a lot of overlays, is seems like when I try to load a lot overlays it stall and provide me with "((null)) was false: Reached the max number of texture atlases, can not allocate more."

我只是以这种方式将图像添加为叠加层:

I'm just adding images as overlays this way:

...
if (image != nil) {
                let image: CGImage = (image?.cgImage)!
                let icon = UIImage(cgImage: image)

                let overlay = GMSGroundOverlay(bounds: overlayBounds, icon: icon)
                overlay.bearing = 0
                overlay.map = map
                overlay.zIndex = 10

                self.overlays.append(overlay);

关于如何解决此问题的任何建议?

Any suggestions on how to fix this issue?

推荐答案

不是设置标记的iconView,而是设置标记的图标.这也会在for循环之外初始化图像:

Instead of setting marker's iconView, set marker's icon. That too initializes the image outside of the for loop:

func displayMarkers() {
    let iconImage = UIImage(named: "locationgreen")
    for partner in partners {
        let lat : Double = Double(partner.location?.coordinates![1] ?? 0)
        let lng : Double = Double(partner.location?.coordinates![0] ?? 0)

        let position = CLLocationCoordinate2D(latitude: lat, longitude: lng)
        let marker = GMSMarker(position: position)
        marker.title = partner.name
        marker.icon = iconImage
    }
}

这篇关于“达到纹理图集的最大数量,无法分配更多"使用谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 09:17