我有我的自定义注释。我时不时地为它制作动画:
UIView.animateWithDuration(duration, delay: 0, options: .CurveLinear, animations: {
customAnnotation.coordinate = newCoordinate
当发生这种情况时,我无法点击它来调用 mapView:didSelectAnnotationView
我什至将 UIButton 添加为 subview :
let button = UIButton(frame: CGRect(x: 7.25, y: 17, width: 37, height: 15))
let text = customAnnotation.displayedName
button.setTitle(text, forState: .Normal)
button.backgroundColor = UIColor.blackColor()
button.setTitleColor(UIColor.greenColor(), forState: .Normal)
button.addTarget(self, action: "buttonTapped:", forControlEvents: .TouchUpInside)
customAnnotationView?.addSubview(button)
在 mapView:viewForAnnotation 中,但它也不起作用。 有什么想法吗?
最佳答案
使用下面的方法可能适合您。
View.animateWithDuration(duration, delay: 0, options: .CurveLinear | .AllowUserInteraction , animations: {
customAnnotation.coordinate = newCoordinate
})
关于ios - 动画时无法点击注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39291423/