Reputation: 11193
I'm new to animation in ios and i'm trying to apply an animation on the titleView in the navigationBar but following code keep saying:
Cannot invoke 'animateWithDuration' with an argument list of type '(FloatLiteralConvertible, delay: FloatLiteralConvertible, options: UIViewAnimationOptions, animations: () -> () -> $T4, completion: (($T16) -> ($T16) -> $T15) -> (($T16) -> $T15) -> $T15)'
when i remove the
self.navigationItem.titleView?.center = CGPointMake(10, 10)
there is no error, but how can i apply an animaiton on the titleView/title?
@IBAction func animateButtonTapped(sender: UIBarButtonItem) {
UIView.animateWithDuration(0.7, delay: 1.0, options: UIViewAnimationOptions.CurveEaseOut, animations: {
self.navigationItem.titleView?.center = CGPointMake(10, 10)
}, completion: { finished in
println("Basket doors opened!")
})
}
Upvotes: 0
Views: 947
Reputation: 6377
UIView.animateWithDuration(0.7, delay: 1.0, options:.CurveEaseOut, animations: {
// Optional chaining may return nil
_ = self.navigationItem.titleView?.center = CGPointMake(10, 10)
// return
}, completion: {
finished in
println("Basket doors opened!")
})
Upvotes: 1