【问题标题】:How to add zoom in and zoom out button functionality for changing scale of map in xamarin.ios?如何添加放大和缩小按钮功能以更改 xamarin.ios 中的地图比例?
【发布时间】:2016-08-22 13:27:12
【问题描述】:

我已经使用 storyboard 在我的 c# 程序中添加了两个按钮,但是我找不到任何可以更改当前显示地图比例的地图属性。

Xamarin ios 应用程序中是否有任何东西可以通过使用放大和缩小等按钮来更改地图的比例?

【问题讨论】:

    标签: c# ios dictionary xamarin.ios scale


    【解决方案1】:
    CLLocationCoordinate2D coords = map.Region.Center;
    var degrees = MilesToLatitudeDegrees(map.Region.Span.LatitudeDelta / 2);
    MKCoordinateSpan span = new MKCoordinateSpan(degrees, longitudeDelta: map.Region.Span.LongitudeDelta / 2);
    map.Region = new MKCoordinateRegion(coords, span);
    

    在缩放按钮操作中添加上述代码将按预期工作

    【讨论】:

      猜你喜欢
      • 2015-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-11
      • 2016-09-15
      • 1970-01-01
      相关资源
      最近更新 更多