Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. // Timer function
  2. func timerTextToggle(timer: NSTimer) {
  3. if self.animationOngoing == false {
  4. self.flipAnimation()
  5. }
  6. }
  7.  
  8. // Animation function
  9. func flipAnimation() {
  10. // important note: it's UIViewAnimationOptions,
  11. // not UIViewAnimationTransition
  12. self.animationOngoing = true
  13. if self.animationToggle == false {
  14. UIView.transitionFromView(self.singleTapLabel!,
  15. toView: self.doubleTapLabel!,
  16. duration: animDuration,
  17. options: UIViewAnimationOptions.TransitionFlipFromBottom,
  18. completion: {
  19. (value: Bool) in
  20. self.animationOngoing = false
  21. })
  22. } else {
  23. UIView.transitionFromView(self.doubleTapLabel!,
  24. toView: self.singleTapLabel!,
  25. duration: animDuration,
  26. options: UIViewAnimationOptions.TransitionFlipFromTop,
  27. completion: {
  28. (value: Bool) in
  29. self.animationOngoing = false
  30. })
  31. }
  32. self.animationToggle = !self.animationToggle
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement