MKPolygon性能问题 [英] MKPolygon performance problem

查看:98
本文介绍了MKPolygon性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用MKPolygon创建了一大堆叠加层,并创建了一个MKPolygonView.这可以正常工作,但是其中一个叠加层具有大量点(大约800点),这会导致内存和性能问题.我在MKPolygonView上尝试了shouldRasterize,但这产生了相反的影响,对此我并不感到惊讶.

I have created a whole heap of overlays using MKPolygon and created into a MKPolygonView. This works fine but one of the overlays has a butt load of points (about 800 points) and this causes memory and performance issues. I tried shouldRasterize on the MKPolygonView but this had the opposite affect which I am not surprised.

除了降低点数(我正在做的事情)之外,我还能做些其他事情来提高它的性能吗?

Is there any other thing I can do to increase the performance of it besides lowing the amount of points (which I am in the process of doing)?

推荐答案

这是Apple已知的但不太可能解决的问题.基本上,除了几个MKOverlayViews之外,无论您使用什么硬件,都将遇到性能问题.基本要做的是将MKPolygonView子类化,并将所有MKPolygons合并到一个MKPolygonView中.

This is an issue that is known by Apple but unlikely to change. Basically anything more then a couple of MKOverlayViews you will have performance issues no matter what your hardware. What you have to basically do is to subclass MKPolygonView and merge all the MKPolygons into one MKPolygonView.

代码可在Apple论坛上找到,但由于我没有编写代码,所以我不认为应该在此处发布代码.

Code is available on Apple Forums but as I didn't write it I don't think I should post it here.

这篇关于MKPolygon性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆