2016-09-02 5 views
1

私のカスタム注釈があります。アニメーション作成時に注釈をタップできません。

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) 
mapViewView:viewForAnnotation内の

が動作しません。 アイデア

答えて

1

下記の使用方法が役立つ場合があります。あなたはoptions中に渡すことができ、他のUIViewAnimationOptionsパラメータの

View.animateWithDuration(duration, delay: 0, options: .CurveLinear | .AllowUserInteraction , animations: { 
          customAnnotation.coordinate = newCoordinate 
}) 
0

一つoptionsに複数のパラメータを渡すには.AllowUserInteraction

public static var AllowUserInteraction: UIViewAnimationOptions { get } // turn on user interaction while animating 

あるそうのような、配列で渡す:

UIView.animateWithDuration(duration, delay: 0, options: [.CurveLinear, .AllowUserInteraction], animations: { 
        customAnnotation.coordinate = newCoordinate 

希望はあなたを助けます。

関連する問題