试图动画我的定制别针形象。
但是,我无法找到访问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
})
谢谢
发布于 2015-09-02 04:00:27
问题解决了!
let clientAnnotation = self.mapView.viewForAnnotation(client)
https://stackoverflow.com/questions/31802663
复制相似问题