xcode MapKit iPhone 开发 - 向地图添加注释 - iOS SDK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5448451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:40:05  来源:igfitidea点击:

MapKit iPhone Development - Adding Annotations to a Map - iOS SDK

iphonexcodeios4mapkit

提问by Laurenz

I would like to create annotations on a Map like this:
img

我想在地图上创建这样的注释:
图片

If you click on the blue arrow a menu should open. In the menu should be two menu points. First a Telephone number (if I click on the number the iphone dial/call this number) and second a "Directions to here".

如果您单击蓝色箭头,应打开一个菜单。在菜单中应该有两个菜单点。首先是电话号码(如果我点击该号码,iphone 会拨打/拨打此号码),然后是“到这里的路线”。

At the moment I run on this code

目前我在这段代码上运行

MKCoordinateRegion region4 = { {0.0, 0.0 }, { 0.0, 0.0 } }; 
region4.center.latitude = 48.13479 ;
region4.center.longitude = 11.582111;
region4.span.longitudeDelta = 0.01f;
region4.span.latitudeDelta = 0.01f;

DisplayMap *ann4 = [[DisplayMap alloc] init]; 
ann4.title = @"The Title!";
ann4.subtitle = @"The Subtitle!"; 
ann4.coordinate = region4.center; 
[mapView addAnnotation:ann4];

How do I show blue-arrow as shown in the image? Can you please suggest me on this..

如何显示如图所示的蓝色箭头?你能在这方面给我建议吗..

回答by saadnib

You have to add a UIButtonof type UIButtonTypeDetailDisclosurein the rightCalloutAccessoryViewof your MKAnnotationView.

您必须添加一个UIButton类型的UIButtonTypeDetailDisclosurerightCalloutAccessoryView你的MKAnnotationView

回答by ryyst

Check out the MKAnnotationView Class Reference, and "Managing Callout Views" specifically.

查看MKAnnotationView Class Reference和“管理标注视图”。