如何使用iOS的mapbox更改showAnnotation缩放? [英] How can I change a showAnnotation zoom using mapbox for iOS?

查看:105
本文介绍了如何使用iOS的mapbox更改showAnnotation缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个方法(见下文),该方法可以放大被点击的注释.

I have a method (seen below) which zooms into an annotation which was tapped.

func mapView(_ mapView: MGLMapView, didSelect annotation: MGLAnnotation) {
    print("Tapped")
    mapView.showAnnotations(pointAnnotations, animated: true)// this does the zooming
    mapView.deselectAnnotation(annotation, animated: false)
}

这有效,但是,我不喜欢它的缩放方式. (当前,一旦您点击它,它就会开始缩放,然后稍微落后于它开始使对象居中,直到到达正确的位置.在那一刻,它突然停止)

This works, however, I dont like the way it zooms. (currently it, as soon as you tap, starts zooming then somewhat lagging behind it begins to center the object until it gets to the correct position. At which point it abruptly stops)

如何更改此项以模拟Snapmap缩放?

我相信他们变焦的过程是变焦在居中开始后开始一点,而这一切发生得更快.另外,停止并不那么突然.我相信它就像轻松的事情.

I believe what happens in their zoom is that the zoom begins a little after the centering begins and this all happens much faster. Additionally, the stopping is not as sudden. I believe Its like ease in thing.

推荐答案

我所做的是使用以下内容使缩放效果更好.查看

What I did is I used the following to make the zoom look much better. Check out here for more info and other versions of this zoom.

            let cam2 = mapView.cameraThatFitsShape(object.polyline!, direction: 0.0, edgePadding: .init(top: 20, left: 30, bottom: 100, right: 30))

            mapView.fly(to: cam2, withDuration: 0.25, completionHandler: nil)

这篇关于如何使用iOS的mapbox更改showAnnotation缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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