i am trying to animate my navigationItem.rightBarButtonItem
to blink repeatedly from green to white... So I do this
UIView.animateWithDuration(1.0, delay:0, options: [.Repeat, .Autoreverse], animations: {
self.navigationItem.rightBarButtonItem?.tintColor = .greenColor()
}, completion: nil)
as i see in this question
and it work
the problem is that i am using UITabView
and every time i switch between views and return to the first view the blink is stop
and i think its because i stuck layer after layer of animation somewhere
i understand that to remove the animation i should use layer.removeAllAnimations()
the problem is that i don't know which view to do it on
i tried self.view.layer.removeAllAnimations()
and it didn't work.
how do i get to this layer that i create for the navigationItem animation
so i can remove it?