iOS:放大并缩小地图上的效果 [英] iOS : zoom in and zoom out effect on map

查看:166
本文介绍了iOS:放大并缩小地图上的效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在此链接上创建了地图,它的工作完美。

I have created map as show on this link and its working perfectly.

但问题是,它只放大一种方式(它只会变大)。我可以以任何一种方式工作吗?

But the problem is, It only zoom in one way (it get bigger only). How could I make it working on either way?

可能就像我们在

May be like we have on google map (plus - minus stick on the left side).

推荐答案

对于ZoomIn

-(void)zoomIn
{
    region.span.latitudeDelta = region.span.latitudeDelta/4 ;
    region.span.longitudeDelta = region.span.longitudeDelta/4;



    region.center.latitude = mapView.centerCoordinate.latitude ;
    region.center.longitude = mapView.centerCoordinate.longitude ;
    [mapView setRegion:region animated:YES];
}

对于ZoomOut

-(void)zoomOut
{
    region.span.latitudeDelta = region.span.latitudeDelta*4 ;
    region.span.longitudeDelta = region.span.longitudeDelta*4;



    region.center.latitude = mapView.centerCoordinate.latitude ;
    region.center.longitude = mapView.centerCoordinate.longitude ;
    [mapView setRegion:region animated:YES];
}




这个结构表示所需的
缩放级别的地图,较小的delta值对应一个
更高的缩放级别。

请参阅这个链接

这篇关于iOS:放大并缩小地图上的效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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