gpt4 book ai didi

ios - "Reached the max number of texture atlases, can not allocate more"使用谷歌地图

转载 作者:搜寻专家 更新时间:2023-10-31 19:28:38 25 4
gpt4 key购买 nike

我正在构建一个使用 Google map 和大量叠加层的应用程序,似乎当我尝试加载大量叠加层时它停止并向我提供 "((null)) was false: Reached纹理图集的最大数量,不能分配更多。”

我只是通过这种方式添加图像作为叠加层:

...
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);

关于如何解决这个问题有什么建议吗?

最佳答案

问题似乎是您正在为每个标记/叠加层分配一个单独的 UIImage 实例。这意味着当您在 GMSMapView 实例上绘制标记时,每个标记都有一个单独的 UIImage。

If you are creating several markers with the same image, use the same instance of UIImage for each of the markers. This helps improve the performance of your application when displaying many markers.

简单地说,您需要限制附加的叠加层。你的图像是动态的还是静态的?如果是同一张图片,一个简单的解决方案是定义一次图片,然后在附加叠加层时添加对同一图片的引用。

关于ios - "Reached the max number of texture atlases, can not allocate more"使用谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43429810/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com