【问题标题】:MapView drop annotation pin with animation IN SWIFT 2.0MapView 在 SWIFT 2.0 中放置带有动画的注释针
【发布时间】:2016-05-03 09:21:54
【问题描述】:

我需要在我的代码中添加一个注释动画。

我有以下代码:

//Add an annotation
let touchPoint = gestureRecognizer.locationInView(mapView)
let newCoordinates = mapView.convertPoint(touchPoint, toCoordinateFromView: mapView)
pinLocation = newCoordinates
let annotation = MKPointAnnotation()
annotation.coordinate = newCoordinates
mapView.addAnnotation(annotation)

问题在于,图钉只是简单地出现了。我需要它在下降时进行动画处理。

如何快速完成?(我需要强调这一点,因为有类似问题的人被标记为重复,但重复的建议是用 Objective-c 编写的)

我需要 swift 来解决这个问题!

【问题讨论】:

  • 提前致谢!我知道这应该是一个简单的修复:)
  • 您需要实现委托方法viewForAnnotation并将MKPinAnnotationView实例的属性animatesDrop设置为true
  • 请输入代码?如果可行,我会选择你作为正确答案:)

标签: swift animation annotations mkmapview mkannotationview


【解决方案1】:

检查您的地图是否已关闭,让连接适合并检查代表。如果一切都很完美,那么应该调用您的注释方法。检查这个条件一次。如果没有,请尝试以下链接

https://www.raywenderlich.com/90971/introduction-mapkit-swift-tutorial

【讨论】:

    猜你喜欢
    • 2015-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多