-
-
Save Pasanpr/690dd3a7bc3d58528fd9 to your computer and use it in GitHub Desktop.
Code for repositioning the text field
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
// Adding observer for notification | |
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ViewController.keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil) | |
// Repositioning the text field | |
func keyboardWillHide(notification: NSNotification) { | |
UIView.animateWithDuration(0.8) { | |
self.textFieldBottomConstraint.constant = 40 | |
self.view.layoutIfNeeded() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment