我有自定义注释。我不时为其设置动画:
UIView.animateWithDuration(duration, delay: 0, options: .CurveLinear, animations: {
customAnnotation.coordinate = newCoordinate
而且发生这种情况时,我无法点击它来调用mapView:didSelectAnnotationView
我什至还添加了UIButton作为子视图:
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
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句