//通知
funcnotification(){
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(HISModifyOrderVC.boardWillShow), name: UIKeyboardWillShowNotification, object:nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(HISModifyOrderVC.boardWillHide), name: UIKeyboardWillHideNotification, object:nil)
}
//键盘出现
funcboardWillShow(notification:NSNotification){
varuserInFo= NSDictionary()
userInFo = notification.userInfo!
varHeight = CGFloat()
Height = (userInFo.objectForKey(UIKeyboardFrameEndUserInfoKey)?.CGRectValue().size.height)!
tbView.frame = CGRectMake(0,0-Height, CGRectGetWidth(UIScreen.mainScreen().bounds), CGRectGetHeight(UIScreen.mainScreen().bounds)-50)
}
//键盘消失
funcboardWillHide(notification:NSNotification){
tbView.frame = CGRectMake(0, -30, CGRectGetWidth(UIScreen.mainScreen().bounds), CGRectGetHeight(UIScreen.mainScreen().bounds)-100)
}
网友评论