简体   繁体   English

如何在MKMapView中绘制形状?

[英]How to draw shape in MKMapView?

I am going to develop a real estate app using xcode storyboard. 我将使用xcode故事板开发一个房地产应用程序。

It has the map search function with selections in the map. 它具有地图搜索功能,可以在地图中进行选择。

So i must draw a shape on the map and get the points of the shape. 因此,我必须在地图上绘制一个形状并获取该形状的点。

And I must convert the point to coordinates. 而且我必须将点转换为坐标。

How can i do this? 我怎样才能做到这一点?

If this is impossible, is there any way to user other map view in iphone app? 如果这不可能,是否有任何方法可以在iPhone应用程序中使用其他地图视图?

I will be very grateful if anyone helps me. 如果有人帮助我,我将不胜感激。

You can take the advantage of overlay. 您可以利用叠加的优势。 There is apple's built in Class MKOVerlayView using this you can achieve it. 有苹果内置的MKOVerlayView类,使用它可以实现它。 Before adding actual overlay over the map if you want to handle drawing in your custom view then you have to take care about Google logo, It should not be hidden otherwise apple's rules will be violated. 如果要在自定义视图中处理绘图,则在地图上添加实际叠加层之前,您必须注意Google徽标,不应隐藏该徽标,否则将违反苹果的规定。 Once user complete drawing over your custom view just convert all points to map points(ie There is method in library not sure name of it) and whole drawing as built in overlayview on map. 一旦用户在自定义视图上完成绘图,只需将所有点转换为地图点(即,库中有方法不确定其名称),并将整个绘图构建为地图上的overlayview内置。 There are some built in overlay views are also exist like MKShape, MKPolyline etc. You can go here to check all about this link 也有一些内置的叠加视图,例如MKShape,MKPolyline等。您可以在此处查看有关此链接的所有信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM