gpt4 book ai didi

ios - 如何将相机移动到 Annotation?

转载 作者:行者123 更新时间:2023-11-28 13:16:12 24 4
gpt4 key购买 nike

伙计们,我需要你们。有一种快速事件的方法,我可以在 map 中移动相机(焦点)以从注释移动到注释?如果不存在,我该如何创建它?请原谅我糟糕的英语!

当我点击按钮转到注释时,我调用了这个方法,它太快了....我怎么减慢了它?我像参数一样传递注释....

func goToAnnotation(annotation: MKPointAnnotation)
{
let span = MKCoordinateSpanMake(0.0002, 0.0002)
let region = MKCoordinateRegion(center: annotation.coordinate, span: span)
self.mapView.setRegion(region, animated: true)
}

最佳答案

MKMapView 有一个方法 showAnnotations:animated:。您可以向其传递一组注释, map 将缩放并重新定位以适应这些动画:

mapView.showAnnotations(myAnnotationsArray, animated: true)

请在此处查看完整文档:https://developer.apple.com/library/mac/documentation/MapKit/Reference/MKMapView_Class/index.html#//apple_ref/occ/instm/MKMapView/showAnnotations:animated :

关于ios - 如何将相机移动到 Annotation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28929260/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com