开发者

MKCoordinateSpanMake: why specify longitude AND latitude delta?

If the distance corresponding开发者_StackOverflow社区 to one degree of longitude is a function of latitude, why do you have to specify longitudeDelta and latitudeDelta when calling MKCoordinateSpanMake in the iOS MapKit? Moreover, how am I supposed to know what the correct ratio is?


You don't need to specify both nor do you need to pre-calculate the ratio.

Both parameters are provided as a convenience if you have a previously saved span or you happen to know the exact span you want.

No matter what values you pass, the map view will still adjust the span so that it fits the map view frame and matches the zoom level that it can display.

You can in fact pass 0.0 for either parameter if you only know or care about one of them. The map view will do the calculations and adjust the span as needed.

To see what the adjusted span will be (or if you want to pre-calculate it), call the regionThatFits: method with a region containing a span such as (10,0).

Also, after calling setRegion:, mapView.region.span will contain the adjusted span as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜