xcode – 如何在MKMapView Swift中放大图钉

xcode – 如何在MKMapView Swift中放大图钉,第1张

概述我希望引脚的位置在敲击引脚时放大,以便位置位于中心.我不知道该怎么做.请帮我. 你想要做的事情有很多. >确定敲击了哪个引脚 >将mapView置于攻丝针上 如果您在项目中正确启动了mapView(以视图作为其委托),则可以使用mapView(_:didSelectAnnotationView:)方法完成上述两点,如下所示: func mapView(mapView: MKMapView, did 我希望引脚的位置在敲击引脚时放大,以便位置位于中心.我不知道该怎么做.请帮我.解决方法 你想要做的事情有很多.

>确定敲击了哪个引脚
>将mapVIEw置于攻丝针上

如果您在项目中正确启动了mapVIEw(以视图作为其委托),则可以使用mapView(_:didSelectAnnotationView:)方法完成上述两点,如下所示:

func mapVIEw(mapVIEw: MKMapVIEw,dIDSelectAnnotationVIEw vIEw: MKAnnotationVIEw) {        // get the particular pin that was tapped        let pinToZoomOn = vIEw.annotation        // optionally you can set your own boundarIEs of the zoom        let span = MKCoordinateSpanMake(0.5,0.5)        // or use the current map zoom and just center the map        // let span = mapVIEw.region.span        // Now move the map        let region = MKCoordinateRegion(center: pinToZoomOn!.coordinate,span: span)        mapVIEw.setRegion(region,animated: true)}

此方法告诉委托(您的视图最有可能)选择了一个地图注释视图并移动(和/或缩放)到该坐标区域.

总结

以上是内存溢出为你收集整理的xcode – 如何在MKMapView Swift中放大图钉全部内容,希望文章能够帮你解决xcode – 如何在MKMapView Swift中放大图钉所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1000322.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存