mkmapview 上的放大、缩小显示隐藏的 mkannotations
我的地图视图上有一个奇怪的问题。
我的地图上有过滤选项来显示和隐藏一些注释。
使用
[[self.gmapViewController.gMap viewForAnnotation:annot] setHidden:YES];或
[[self.gmapViewController.gMap viewForAnnotation:annot] setHidden:NO];
当我过滤 mkmpaview 时,我将地图居中到特定位置。
但问题是......当我尝试放大或缩小时,隐藏的注释会显示在地图上。
如何避免它这样做。
任何人都可以..请让我知道解决方案...
i have a strange problem on my mapview.
I have filtering option on my map to show and hide some annotations.
using
[[self.gmapViewController.gMap viewForAnnotation:annot] setHidden:YES]; or
[[self.gmapViewController.gMap viewForAnnotation:annot] setHidden:NO];
and i center the map to a particular location when i filter the mkmpaview.
but the issue is ... when i try to zoom in or zoom out, the hidden annotations are getting displayed on the map.
how to avoid it doing that.
Could any one ..let me know the solution please...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不能删除注释,然后在您想要的位置再次添加注释,而不是隐藏和显示。
Why cant you remove the annotations and then again add annotations where you want instead of hidding and showing.
当地图视图的边界发生变化时,您不能依赖特定的注释视图来继续表示相同的注释;它重用它们,就像
UITableView
重用其单元格一样。您需要做的是更改annot
本身的某些属性以及更改当前表示它的注释视图的隐藏状态,然后检查该属性并在您的中设置适当的隐藏状态>MKMapViewDelegate
-mapView:viewForAnnotation:
方法。You can't rely on specific annotation views to continue to represent the same annotation as the map view's boundaries change; it reuses them, much as a
UITableView
reuses its cells. What you need to do is change some property ofannot
itself as well as changing the hidden state of the annotation view that currently represents it, then check for that property and set the appropriate hidden state in yourMKMapViewDelegate
-mapView:viewForAnnotation:
method as well.