3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

フワっとしたPopupを出してみる。

Posted at

見た目

movie.gif

(gifだとわかりづらい…orz)

処理抜粋

PopupViewController.swift

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.baseViewWidthConstraint.constant = 0
        self.baseViewHeightConstraint.constant = 0
        self.view.layoutIfNeeded()
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        self.baseViewWidthConstraint.constant = 250
        self.baseViewHeightConstraint.constant = 250

        UIView.animate(withDuration: 1.2, delay: 0.3, usingSpringWithDamping: 0.6, initialSpringVelocity: 10, options: .curveEaseOut, animations: { () -> Void in
            
            self.baseView.alpha = 1.0
            self.view.layoutIfNeeded()
            
        }, completion: nil)
    }

・AutoLayoutでPopupのサイズをいじってアニメーションを実現しています。
・高さも変えるため、baseViewのHeightの制約のPriorityを下げています。

コードはこちらです。

もう少し滑らかでくっきりとバウンドがわかるような処理にしたい(´・ω・`)

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?