问题描述
我想知道从地图上删除注释时,哪种方法更快/更有效:隐藏或删除.每次用户放大或缩小时,我都需要删除并添加100个左右的图钉.
I was wondering which would be faster/more efficient when it comes to taking off annotations from the map: hiding or removing. I need to remove and add 100 or so pins every time the user zooms in or out.
我可以使用setHidden:
循环并隐藏所有注释,也可以使用removeAnnotations:
删除它们.我不确定哪种方法更好.
I can either loop through and hide all annotations using setHidden:
, or just remove them using removeAnnotations:
. I'm not sure which would be a better method.
推荐答案
我相信标准方法是删除它们.更少的内存开销.不是100占用了那么多,但是最好在需要时将其删除并重新添加然后隐藏.
I believe the standard method is to remove them. Less memory overhead. Not that 100 takes up that much, but still better to remove and re-add when needed then to hide.
这篇关于我应该在MKMapView中删除或隐藏注释吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!