MapKit:添加自定义标注 [英] MapKit : Add custom callout

查看:86
本文介绍了MapKit:添加自定义标注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加自定义annotationView标注,其中包含
1.标题
2.字幕
3.一个按钮

I want to add custom annotationView callout which contains 1. Title 2. subtitles 3. a button

按钮可以显示在右侧( rightCalloutAccessoryView )或左侧 leftCalloutAccessoryView 标注的两侧。我想在标注的中间添加按钮并在标题 - >副标题下添加。我该怎么办?

The button can display on the right (rightCalloutAccessoryView) or left leftCalloutAccessoryViewsides of the callout. I want to add the button in the middle of the callout and under title->subtitle. How can I do?

推荐答案

这里没有API。您可以尝试不使用标准callout(canShowCallout = NO),手动捕获AnnotationView上的点击和拖动,并通过基于AnnotationView的位置添加自定义视图来显示您自己的UI。但这似乎非常脆弱。

There is no API for this. You could try not using the standard callout (canShowCallout = NO), catch the taps and drags on the AnnotationView manually and show your own UI by adding custom Views based on the position of the AnnotationView. This seems very fragile, though.

这篇关于MapKit:添加自定义标注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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