1

I have this code for animating a table:

    UIView.animateWithDuration(0.33, delay: 0, options: UIViewAnimationOptions.CurveEaseOut | UIViewAnimationOptions.AllowUserInteraction, animations: { () -> Void in

    self.myTableView.setContentOffset(CGPoint(x: 0, y: offSetY), animated: false)


    }, completion: nil)

I want to have the additional option UIViewAnimationOptions.AllowUserInteraction but I get the error: "| cannot be applied to two UIViewAnimationOptions operands". How can I add this? Works in objective-c.

KexAri
  • 3,867
  • 6
  • 40
  • 80
  • For more details, check this (identiqual) thread http://stackoverflow.com/questions/24081192/uiview-animation-options-using-swift?rq=1 – jcnm Feb 16 '16 at 13:53

1 Answers1

4

In Swift 2 you have to write in this way. The OptionSetType has an updated syntax.

UIView.animateWithDuration(0.33, delay: 0, options:[UIViewAnimationOptions.CurveEaseOut, UIViewAnimationOptions.AllowUserInteraction], animations: { () -> Void in

        self.myTableView.setContentOffset(CGPoint(x: 0, y: 8), animated: false)


        }, completion: nil)
Cong Tran
  • 1,448
  • 14
  • 30