简体   繁体   English

MapKit修复缩放

[英]MapKit fix zoom

I have mapkit view and i need to fix zoom step. 我有mapkit视图,我需要修复缩放步骤。 User must only increase or decrease by 4 times. 用户只能增加或减少4倍。 How i can do it in MapKit? 我如何在MapKit中做到这一点?

The map doesn't provide a method to restrict the zoom increment. 地图未提供限制缩放增量的方法。 I should also say that the default implementation of the map view on the iPhone leads to better user experience I think. 我还应该说,我认为iPhone上地图视图的默认实现会带来更好的用户体验。 I personally dislike apps that limit my capabilities for no good reason. 我个人不喜欢无缘无故限制我功能的应用程序。

To answer your question though, you can manually control your zooming, by disabling MKMapView.zoomEnabled property. 但是,要回答您的问题,您可以通过禁用MKMapView.zoomEnabled属性来手动控制缩放。 Then you can expose a zoom buttons that change the shown map region, using setRegion:animated: . 然后,您可以使用setRegion:animated:暴露可更改显示地图区域的缩放按钮。

Here is a sample code on how to zoom the map: 以下是有关如何缩放地图的示例代码:

-(void)zoomMap:(MKMapView *)map withLevelMultiple:(void)levelMultiplier {
  MKCoordinateRegion region = map.region;
  region.span.latitudeDelta /= levelMultiplier;
  region.span.longitudeDelta /= levelMultiplier;
  [map setRegion:region animated:YES];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM