Created
October 21, 2015 17:36
-
-
Save nh7a/363225f2018a014156da to your computer and use it in GitHub Desktop.
This file contains 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
func keyboardWillShow(notification: NSNotification) { | |
let info = notification.userInfo! | |
let rect = (info[UIKeyboardFrameEndUserInfoKey] as! NSValue).CGRectValue() | |
let duration = info[UIKeyboardAnimationDurationUserInfoKey] as! Double | |
let curve = notification.userInfo![UIKeyboardAnimationCurveUserInfoKey] as! UInt | |
let opts = UIViewAnimationOptions(rawValue: curve << 16) | |
UIView.animateWithDuration(duration, delay: 0, options: opts, animations: { | |
self.bottomConstraint.constant = rect.height | |
self.view.layoutIfNeeded() | |
}) { (finish: Bool) in | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment