本文介绍了setVisibleCoordinateBounds从未设置确切的边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使用mapbox(ios/swift)setVisibleCoordinateBounds函数来将地图的视口居中到给定的BoundsCoords. 在此处查看api

i'm struggleing with the mapbox (ios/swift) setVisibleCoordinateBounds function to center the viewport of a map to the given BoundsCoords. see api here

当我调用函数时,它从不设置确切的范围,也没有设置更具体的缩放级别.给定的boundsCoords是正确的.还尝试了setCenterCoordinate:zoomLevel:direction:animated:completionHandler,因为我需要一个completionHandler.但是它有山姆的问题.有人遇到过类似的问题吗?

It never set the exact Bounds or more specific it sets diffrent zoom levels whenever i call the function. the given boundsCoords are correct. Also tried setCenterCoordinate:zoomLevel:direction:animated:completionHandler cause i need an completionHandler. But it has the sam issues. Somebody experienced similar issues ?

推荐答案

使用一种允许您自定义边缘填充的方法,例如: -[MGLMapView setVisibleCoordinates:count:edgePadding:direction:duration:animationTimingFunction:completionHandler:] .

Use one of the methods that allows you to customize the edge padding, such as: -[MGLMapView setVisibleCoordinates:count:edgePadding:direction:duration:animationTimingFunction:completionHandler:].

如果不需要任何填充,请将edgePadding设置为UIEdgeInsetsZero.

Set edgePadding to UIEdgeInsetsZero, if you don’t need any padding.

在即将发布的v3.3.0中,将会有一个 -[MGLMapView cameraThatFitsCoordinateBounds:edgePadding:] 方法.

In the upcoming v3.3.0, there will be a -[MGLMapView cameraThatFitsCoordinateBounds:edgePadding:] method, as well.

这篇关于setVisibleCoordinateBounds从未设置确切的边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!