键盘的处理高度

键盘的处理高度

风流意气都作罢 提交于 2020-03-06 10:47:35
//通知:注册键盘将要出现的通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboadWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; /** * 键盘的处理 */ //键盘出现时候调用的事件 -(void) keyboadWillShow:(NSNotification *)note{ //获取字典: NSDictionary *infoDic = note.userInfo; if (!_texField.isFirstResponder) return; //键盘的frame: CGSize keyboardSize = [[infoDic objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size; //textF一下的高度高度 CGFloat offY