![防止输入时键盘覆盖掉textfiled 防止输入时键盘覆盖掉textfiled](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
添加监听者
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardwasChange:) name:UIKeyboardWillChangeFrameNotification object:nil];
监听键盘之后的操作
可以根据自己的需要调整高度的大小
- (void)keyboardwasChange:(NSNotification *)info { CGRect keyFrame = [info.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGFloat tY = keyFrame.origin.y - self.view.frame.size.height - ; self.view.transform = CGAffineTransformMakeTranslation(, tY); }