开发者

iPhone: Set Map zoom level on the base of distance

I want to set the zoom level of google map on the base of variable value so it show only part of map on start-up. Basically i want to show only surrounding area from user location.

For exam开发者_StackOverflow中文版ple if variable value is 30 mile, then map show only 30 mile surrounding area from current location and zoom in/out accordingly.


Create a MKCoordinateRegion using the MKCoordinateRegionMakeWithDistance function and pass it to the map view's setRegion:animated: method.

Note that MKCoordinateRegionMakeWithDistance requires meters so you'll need to convert the miles to meters first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜