有没有办法限制MKMapView的最大缩放级别? [英] Is there way to limit MKMapView maximum zoom level?

查看:176
本文介绍了有没有办法限制MKMapView的最大缩放级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是 - 有没有办法限制MKMapView的最大缩放级别?或者有没有办法跟踪用户何时缩放到没有地图图像的水平?

the question is - is there a way to limit maximum zoom level for MKMapView? Or is there a way to track when user zooms to the level where there's no map image available?

推荐答案

你可以使用 mapView:regionWillChangeAnimated:委托侦听区域变更事件的方法,如果区域比最大区域宽,请使用将其设置回最大区域setRegion:animated:向您的用户表明他们无法缩小那么远。以下是方法:

You could use the mapView:regionWillChangeAnimated: delegate method to listen for region change events, and if the region is wider than your maximum region, set it back to the max region with setRegion:animated: to indicate to your user that they can't zoom out that far. Here's the methods:

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
- (void)setRegion:(MKCoordinateRegion)region animated:(BOOL)animated

这篇关于有没有办法限制MKMapView的最大缩放级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆