【问题标题】:MKMapView setting zoom limit without bouncingMKMapView 设置缩放限制而不弹跳
【发布时间】:2013-09-15 09:38:28
【问题描述】:

stackoverflow 上有很多关于 MKMapView 的最大缩放的问题和答案,例如:

Is there way to limit MKMapView maximum zoom level?

不幸的是,实际上没有一个答案对我有用(或者我只是没有正确实施)。我无法模拟原生地图的行为,那就是 - 限制缩放级别而不“反弹”或恢复。

这是我使用的代码:

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
{ 
    if( mapView.region.span.latitudeDelta<0.001 || mapView.region.span.longitudeDelta<0.001){
        MKCoordinateRegion region =mapView.region;
        region.span = MKCoordinateSpanMake(0.001, 0.001);
        mapView.region = region;
        [mapView setRegion:mapView.region animated:NO];
    }
}

当用户捏合和缩放地图并且地图达到最大缩放(由我设置)时,地图不应放大然后反弹。有可能吗?

【问题讨论】:

    标签: ios objective-c mkmapview mapkit mkmapviewdelegate


    【解决方案1】:

    据我所知,如果不自己制作,我认为实际上不可能设置最大缩放或最小缩放。但我知道,如果你使用 Google Map SDK,你实际上可以为地图设置最大和最小缩放:https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_map_view

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-06
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多