本文介绍了放置在屏幕中心的MKMapView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用此代码删除引脚的函数:

  ParkPlaceMark * placemark = [[ParkPlaceMark alloc] initWithCoordinate:location ]。 
[mapView addAnnotation:placemark];

如何将此引脚置于屏幕中央?

我想要与优步应用类似的产品:
http://cl.ly/362q153W461Y1g3X1o04



用户位于,掉落为红色的针脚。然后,用户可以设置自定义位置(在Uber的情况下,他们希望用出租车接送),以及点击按钮确认该位置。
当用户设置自定义位置时,自定义位置引脚居中显示在屏幕上,并且只有地图正在移动。


在Internet上有这样的例子,你可以帮我做一些简单的样本吗? 解决方案

假设地标实现了 MKAnnotation 协议,可以将地标坐标属性设置为您的 em> mapView 对象。



这将意味着地标将始终放置在地图上位于 mapView 目前正在寻找。



希望这有助于您。 :)

I have a function that drop pin with this code:

ParkPlaceMark *placemark=[[ParkPlaceMark alloc] initWithCoordinate:location];
[mapView addAnnotation:placemark];

How to put this pin on center of the screen?

I want something similar to Uber app:http://cl.ly/362q153W461Y1g3X1o04

User is located, dropped is red pin. Then, user can set custom location (in Uber's case, where they want to be picked with taxi cab), and when tap to button to confirm that location.When user setting custom location, custom location pin is centered on screen, and only map is moving.

There is some sample with this on the Internet, or can you help me with some short sample?

解决方案

Assuming that placemark implements the MKAnnotation protocol, you can set the coordinate property of placemark to the value of the centerCoordinate property of your mapView object.

This will mean that the placemark will always be placed on the map at the coordinate that is at the centre of where the mapView is currently looking.

Hope this helps. :)

这篇关于放置在屏幕中心的MKMapView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 03:11