Moving annotation from one coordinate point to another in Swift

◇◆丶佛笑我妖孽 提交于 2019-12-13 06:59:17

问题


This is a repost. I tried all I could do to get this thing done but wasn't successful. I have two coordinate points and all I'm trying to do is moving an annotation from one point to another.

As an alternative solution, I found an Obj-C project in github which is very similar to this and I made a bridged connection between Swift and Obj-C to get this done. But for just moving annotation I had to use this whole project which I found is not a good solution.

Anyone who was successful in implementing such functionality (in swift)?


回答1:


If you are using MKPointAnnotation as base, you can access the coordinate property, which is actually defined as var, e.g.

var coordinate: CLLocationCoordinate2D

Apple MKPointAnnotation Documentation. Therefore, when changing the coordinate, your annotation will move to another location.



来源:https://stackoverflow.com/questions/27969937/moving-annotation-from-one-coordinate-point-to-another-in-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!