自定义标注气泡 MKMapView
我想要做的是在 MKMapView 中创建自定义标注气泡,正如 http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/,但是看起来这个原本做得很好的应用程序中存在一些错误。例如,当您将自定义标注气泡保持打开状态并滚动离开时,地图会在某个时刻滚动回打开的标注。缩放有时也会触发此错误。有人能够解决这些问题吗?抱歉创建了一个新问题(因为有几个解决自定义标注气泡),但我没有足够的代表点来评论答案。
What I am wanting to do is to create a custom callout bubble in MKMapView, just as it is explained in http://blog.asolutions.com/2010/09/building-custom-map-annotation-callouts-part-1/, but it seems that there are some bugs in that otherwise nicely done application. For example, when you leave the custom callout bubble open, and scroll away, then at some point the map scrolls back to the open callout. Also zooming sometimes triggers this bug. Has anyone been able to solve those problems? Sorry for creating a new question (as there are a couple addressing custom callout bubble), but I did not have enough rep points to comment an answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决这个问题的方法是在 CalloutMapAnnotationView: didMoveToSuperview,
如果我们取消选择注释,则不要调用 adjustmentMapRegionIfNeeded。
因此,我修复它的方法是在我的mapViewController:didDeselectAnnotationView中,在从mapView中删除Annotation之前,我为BasicMapAnnotationView分配一个非零标记值。我选择了 159。
然后,在 CalloutMapAnnotationView 中,我检查该值,如果找到,我不会调整地图。
The fix for this is in CalloutMapAnnotationView: didMoveToSuperview,
if we're de-selecting the annotation, then do not call adjustMapRegionIfNeeded.
So the way I fixed it is in my mapViewController: didDeselectAnnotationView, I assign a non-zero tag value to the BasicMapAnnotationView right before I removeAnnotation from the mapView. I chose 159.
Then, in CalloutMapAnnotationView, I check for this value, and if found, I don't adjust the map.