Objective C 地图查看问题
我一直在使用地图视图并遇到这些变量:span.longitudeDelta 和 span.latitudeDelta ...它们似乎会影响屏幕的缩放量(可能通过设置窗口的 x/y 来实现?)谁能告诉我这些值的作用是什么以及它们与屏幕宽度/高度(以纬度/经度为单位)有何关系?
感谢您抽出时间。
编辑:我想知道这个,因为我试图弄清楚我的屏幕正在查看的纬度和长度是多少度......示例:如果我缩小屏幕的最左侧可能是 34.533,右侧可能是 34.533边可能是 39.324。
I have been working with the map view and came across these variables: span.longitudeDelta and span.latitudeDelta... They seem to effect the amount of zoom of the screen(possibly by setting the window's x/y?) Can anyone tell me what these values do and how they relate to the screens width/height in degrees of lat/long?
Thank you for your time.
Edit: I am wondering this because I am trying to figure out what degrees of lat and long my screen is looking at.... Example: if I am zoomed way out the very left hand side of my screen could be 34.533 and the right side could be 39.324.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的想法是正确的。这些值是地图视图的宽度和高度(以度为单位),以地图中心点为中心。
map.region 是您可以读取或设置的 MKCooperativeRegion。 MKCoordinateRegion 是一个具有两个字段的结构:center 和 span。 map.region.center 是一个 CLLocation2D 结构(有两个字段,纬度和经度),map.region.span 是一个 MKCooperativeSpan 结构,其中包含您提到的字段。
如果要设置地图以显示给定区域,请创建一个 MKCooperativeRegion,设置属性,然后确保该区域适合地图的大小:
屏幕的左边缘是(粗略地说,因为经度线不是平行线):
You have the right idea. These values are the width and height of the map view in degrees, centered on the map's center point.
map.region is an MKCoordinateRegion that you can read or set. MKCoordinateRegion is a struct with two fields: center and span. map.region.center is a CLLocation2D struct (which has two fields, latitude and longitude) and map.region.span is an MKCoordinateSpan struct with the fields you mentioned.
If you want to set a map to show a given area, create an MKCoordinateRegion, set the properties, then make sure that the region fits the size of your map with:
The left edge of your screen is (roughly, since longitude lines are not parallel):