1.在viewdidload中,注册如下监听:
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShow:", name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillHide:", name: UIKeyboardWillHideNotification, object: nil)
2. 实现对应的监听触发方法:
func keyboardWillShow(note:NSNotification){
var userInfo:NSDictionary = note.userInfo!
var aValue:NSValue = userInfo.