【问题标题】:How to zoom mapView and setCenterCoordinate at the same time?如何同时缩放 mapView 和 setCenterCoordinate?
【发布时间】:2014-11-10 19:02:25
【问题描述】:

我有一个 mapView,我使用 didUpdateLocations 来显示位置用户,但我也使用 setCenterCoordinate 来显示预先确定的 pin 蓝色圆圈,以显示 mapView 左侧的位置。但是如果我使用 setCenterCoordinate 地图不会缩放...

 churchLocation.longitude += self.mapView.region.span.longitudeDelta * 0.15;

    churchLocation.latitude += self.mapView.region.span.latitudeDelta * 0.10;

 self.mapView.setRegion(theRegion, animated: true)
    self.mapView.setCenterCoordinate(churchLocation, animated: true)

我该怎么做?

谢谢!

【问题讨论】:

    标签: swift geolocation mapkit core-location


    【解决方案1】:

    setRegionsetCenterCoordinate 将相互对抗。该视图将查看theRegion 的中心,然后您尝试将其移动到churchLocation

    如果您想同时设置缩放级别和缩放级别,您应该使用churchLocation 并计算其周围的区域,然后调用setRegion

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-06
      相关资源
      最近更新 更多