从 mapView.annotations 访问 MKAnnotationView

Access MKAnnotationView from mapView.annotations

正在尝试为我的自定义图钉图片制作动画。

但是我找不到访问 MKAnnotationView 的方法。

这个任务很简单,例如当你使用

func mapView(mapView: MKMapView!, didSelectAnnotationView view: MKAnnotationView!) {

}

如你所见。

但我希望能够为我放大到的区域的一组图钉设置动画。

使用内置的 mapView 属性 注释我可以获得我需要的引脚。

那么在

之内
    func findThePins(searchName:String) {

    var foundItems = [Client]()

    for aPin in mapView.annotations as! [Client] {

        if aPin.clientName.uppercaseString.rangeOfString(searchName.uppercaseString) != nil {
            foundItems.append(aPin)
        }
    }

    if !foundItems.isEmpty {
        println("move map - \(foundItems.count)")
        // moves to show the area of the screen containing the pins
        mapView.showAnnotations(foundItems, animated: true)
        // How to animate those pins in foundItems
    }
}

如何访问视图以便制作动画。我有一种感觉,我走错了路。

didSelectAnnotationView

中可以正常工作的示例动画
UIView.animateWithDuration(1.0, delay: 0.0, options: nil, animations: { () -> Void in
pinView.transform = CGAffineTransformMakeScale(2.0, 2.0)
}, completion: { (completed) -> Void in
pinView.transform = CGAffineTransformIdentity
})

谢谢

问题已解决!

let clientAnnotation = self.mapView.viewForAnnotation(client)