LoginSignup
12
11

More than 5 years have passed since last update.

同じViewで遷移アニメーションを使う

Posted at

FlipHorizontal.gif

画面遷移する際のアニメーションを、同じViewで表示を切り替えるタイミングで使用する方法。

@IBAction func Button(sender: AnyObject) {
  if Label.text == "A"  {
    UIView.transitionWithView(self.view, duration: 0.725, options: .TransitionFlipFromLeft, animations: {
      // animation
      self.Label.text = "B"
      }, completion: { (finished: Bool) -> () in
      // completion
    })
  }else{
    UIView.transitionWithView(self.view, duration: 0.725, options: .TransitionFlipFromRight, animations: {
      // animation
      self.Label.text = "A"
      }, completion: { (finished: Bool) -> () in
      // completion
    })
  }
}

参考

UIView transitioning to the same view

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11