iOS地图 mapView.region.span.latitudedelta 属性

应客户要求需要限制地图的显示范围,但因了解不深,所以效果总是不理想。终小有体会,留记以醒。

先看官方文档:

MKCoordinateSpan

A structure that defines the area spanned by a map region.

typedef struct {

   CLLocationDegrees latitudeDelta;

   CLLocationDegrees longitudeDelta;

} MKCoordinateSpan;

Fields

latitudeDelta

The amount of north-to-south distance (measured in degrees) to display on the map. Unlike longitudinal distances, which vary based on the latitude, one degree of latitude is always approximately 111 kilometers (69 miles).

longitudeDelta

The amount of east-to-west distance (measured in degrees) to display for the map region. The number of kilometers spanned by a longitude range varies based on the current latitude. For example, one degree of longitude spans a distance of approximately 111 kilometers (69 miles) at the equator but shrinks to 0 kilometers at the poles.

Discussion

You use the delta values in this structure to indicate the desired zoom level of the map, with smaller delta values corresponding to a higher zoom level.

Availability

  • Available in iOS 3.0 and later.

Declared In

MKGeometry.h

     按上文理解,假设屏幕宽度固定,随着地图的上下拖动,longitudeDe应该相应的变化,越接近赤道数值越小。但是实际测试后发现,是latitudeDelta变化,而且是越靠近两极数值越小,位于赤道时最大。

     地球是椭球形,上面的文档应该无错,但不知道什么实际结果却不同?如果有高人来访,还望指点。

转载于:https://my.oschina.net/u/728866/blog/123940

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值