将图钉放在屏幕中央,MKMapView
我有一个使用以下代码放置图钉的功能:
ParkPlaceMark *placemark=[[ParkPlaceMark alloc] initWithCoordinate:location];
[mapView addAnnotation:placemark];
How to put this pin on the center of the screen?
我想要类似 Uber 应用程序的东西: http://cl.ly/362q153W461Y1g3X1o04
用户已定位,掉落的是红色图钉。然后,用户可以设置自定义位置(在 Uber 的情况下,他们希望用出租车来接载),然后点击按钮确认该位置。 当用户设置自定义位置时,自定义位置图钉位于屏幕中央,并且只有地图在移动。
互联网上有一些示例,或者您可以帮我提供一些简短的示例吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设地标实现了MKAnnotation协议,您可以将地标的
坐标
属性设置为centerCooperative
的值mapView 对象的属性。这意味着地标将始终放置在地图上 mapView 当前查看位置的中心坐标处。
希望这有帮助。 :)
Assuming that placemark implements the MKAnnotation protocol, you can set the
coordinate
property of placemark to the value of thecenterCoordinate
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. :)