Created
March 4, 2018 14:49
-
-
Save hcn1519/b55b0741cd6fc1b64e0723321faa1395 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
class VC: ViewController { | |
var keyboardVisible = true | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: .UIKeyboardWillShow, object: nil) | |
} | |
deinit { | |
NotificationCenter.default.removeObserver(self) | |
} | |
@objc func keyboardWillShow(notification: NSNotification) { | |
// 여기서 키보 높이 받을 수 있어 | |
let userInfo = notification.userInfo ?? [:] | |
let keyboardFrame = (userInfo[UIKeyboardFrameBeginUserInfoKey] as! NSValue).cgRectValue | |
// do something | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment