Created
October 10, 2016 01:51
-
-
Save MTattin/5fe1701fff605e5e778e16f30873b6ad to your computer and use it in GitHub Desktop.
swift3でのUIView.animateの挙動の違いについてのメモ ref: http://qiita.com/MTattin/items/3d541901db4b36e646d1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// アニメーション表示 | |
/// | |
self.constraintBottom.constant = 0 | |
UIView.animate(withDuration: 0.1, animations: { [weak self] in | |
self?.layoutIfNeeded() | |
}, completion: nil) | |
/// | |
/// アニメーション非表示 | |
/// | |
self.constraintBottom.constant = -self.frame.size.height | |
UIView.animate(withDuration: 0.1, animations: { [weak self] in | |
self?.layoutIfNeeded() | |
}, completion: nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// アニメーション表示 | |
/// | |
self.constraintBottom.constant = 0 | |
UIView.animate(withDuration: 0.1, animations: { [weak self] in | |
self?.superview?.layoutIfNeeded() | |
}, completion: nil) | |
/// | |
/// アニメーション非表示 | |
/// | |
self.constraintBottom.constant = -self.frame.size.height | |
UIView.animate(withDuration: 0.1, animations: { [weak self] in | |
self?.superview?.layoutIfNeeded() | |
}, completion: nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment