swift - How to repeat flip animation? -
i'm trying create own activity indicator view twitch chat activity indicator view. i've tried use animate .repeat
:
override func animate() { uiview.animate(withduration: 1, delay: 0, usingspringwithdamping: 1, initialspringvelocity: 1, options: [.repeat, .transitionflipfromleft], animations: { self.flip() }, completion: nil) }
and timer
let timer = timer.init(timeinterval: 2, target: self, selector: #selector(flip), userinfo: nil, repeats: true)
here flip()
function
func flip() { self.isflipped = !self.isflipped let fromview = self.isflipped ? self.view1 : self.view2 let toview = self.isflipped ? self.view2 : self.view1 uiview.transition(from: fromview, to: toview, duration: 1, options: [.transitionflipfromtop, .showhidetransitionviews], completion: nil) }
but did not work. don't know missed. can guys me please?
Comments
Post a Comment