2013-08-04 38 views

回答

-1

您并不一定需要使用自定义URL。 Apple为他们的iOS 6地图框架添加了一个名为MKMapItem的类。您将使用此类的方式是在将地图叠加层添加到地图应用程序时添加所需的必要信息。

下面是一个例子:

MKPlacemark *placemark=[[MKPlacemark alloc] initWithCoordinate:theCoordinate addressDictionary:theCoordinatePlaceDictionaryRepresentation]; 
MKMapItem *item=[[MKMapItem alloc] initWithPlacemark:placemark]; 
[item setName:theCustomTitleYouWant]; 
[item setPhoneNumber:phoneNumberIfAny]; 
[item setUrl:aWebSiteToThePlaceToVisitIfAny]; 
[item openInMapsWithLaunchOptions:aLaunchOptionDictionaryIfAny]; 

检查的启动选项字典中的键:

MKLaunchOptionsDirectionsModeKey; MKLaunchOptionsMapTypeKey; MKLaunchOptionsMapCenterKey; MKLaunchOptionsMapSpanKey; MKLaunchOptionsShowsTrafficKey;

它允许您自定义地图的外观和工作方式。

希望这会有所帮助。

编辑:这与本机iOS代码有关。你可以找到关于url链接的信息here

+0

非常感谢你的帮助, 但我只想问你,请问我该如何补充? 它在页面的头部或什么?因为我不想在Safari浏览器中打开它,而是在本机iOS 6地图应用程序中打开它,所以我想将它添加到HTML页面或PHP中。 谢谢, – user2649642

+0

请参阅编辑和新链接。 – J2theC