简体   繁体   English

从MapView删除标准标注

[英]Remove the Standard callout from MapView

I need to remove the Standard Callout from the mapview and want to display my custom callout. 我需要从地图视图中删除标准标注,并要显示我的自定义标注。 My custom Callout is having image and many fields. 我的自定义标注具有图片和许多字段。 I am designing my custom callout in interface builder. 我正在界面构建器中设计我的自定义标注。 How I can display my custom callout ? 如何显示自定义标注?

I have referred to the link "Custom callout Bubble", But I want to display the custom callout from xib. 我已经提到了链接“自定义标注气泡”,但是我想显示来自xib的自定义标注。

It's not simple, but you can do it. 这并不简单,但是您可以做到。 You need to create an alternative MKAnnotationView (BubbleView) and show it when you select the first one. 您需要创建一个替代的MKAnnotationView(BubbleView)并在选择第一个时显示它。 It's possible to differentiate the AnnotationView from BubbleView in delegate. 可以在委托中将AnnotationView与BubbleView区分开。

You have a lot of work to do, this tutorial can help you to understand the passages, but pay attention on iOS 6, some things are changed and there are some problems in BubbleView positioning 您需要做很多工作,本教程可以帮助您理解文章,但请注意在iOS 6上,某些功能已更改,并且BubbleView定位存在一些问题

http://www.jakeri.net/2009/12/custom-callout-bubble-in-mkmapview-final-solution/ http://www.jakeri.net/2009/12/custom-callout-bubble-in-mkmapview-final-solution/

Custom callouts are nearly impossible to implement. 自定义标注几乎不可能实现。 You have to simulate a callout by adding your own custom MKAnnotationView to your MKAnnotations, listen to their selection, then listen to your MKANnotationView's didMoveToSuperView callbacks to handle your own animations and drawing. 您必须通过将自己的自定义MKAnnotationView添加到MKAnnotation来模拟标注,听其选择,然后听MKANnotationView的didMoveToSuperView回调来处理自己的动画和图形。

My implementation on the iPad took weeks to get right and if I were to do it again I wouldn't use Apple's MapKit at all. 我在iPad上的实现花费了数周的时间才能实现 ,如果我要再做一次,我根本就不会使用Apple的MapKit。 I'd use another mapping framework altogether that made the process easier. 我将完全使用另一个映射框架来简化此过程。

tldr - you can't do it - trust me tldr-你做不到 - 相信我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM