从MKMapView中找出您所在的区域 [英] Find out which type of area you are in from MKMapView

查看:75
本文介绍了从MKMapView中找出您所在的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从MKMapView确定你所在的区域?即如果地图的中心位于海洋中,我们可以告诉用户:地图的中心位于海洋上方,或者如果地图位于绿色区域的中心:地图的中心位于公园之上......

is there any way to determine which type of area you are in from a MKMapView? I.e. if the centre of the map is in the ocean we can tell the user: the centre of the map is above the ocean, or if the map is centred above a green area: the centre of the map is above parkland...

我能想到的唯一方法是创建可见屏幕的屏幕截图,并使用以下方法分析每个位的颜色: iOS - 检测像素的颜色?

The only way I can think of to do this is to create a screenshot of the visible screen and analyse the colour of each bit by using some method such as this: iOS -- detect the color of a pixel?

但是我有兴趣知道是否有更容易想到的方式!

However I would be interested to know if there is an easier way that anyone can think of!

EDIT

为了让我更清楚我正在寻找什么,我基本上想找到一种方法将地图的一部分变成游戏的自上而下的水平,不同的区域由地图区域......

To make it more clear what I'm looking for, I'm basically looking for a way to turn a section of a map into a top down level for a game, with different areas determined by the areas of the map...

推荐答案

A CLPlacemark 有一对属性: inlandWater ocean w当地标在水中时,他会告诉你。我想你可以从地理编码器获得一个地标。

A CLPlacemark has a couple of properties: inlandWater and ocean which tell you when the placemark is in water. I think you can get a placemark from the geocoder.

它还有 areasOfInterest 这将为你提供公园和地标。

It also has areasOfInterest which will give you parks and landmarks.

这篇关于从MKMapView中找出您所在的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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