Uitableview 禁用tableview滚动时,使用tableview键盘避免的uitextfields
我在tableview上有10个文本字段,禁用了tableview滚动 如何处理键盘避免文本字段 以下是我尝试过的 //显示键盘时注册通知Uitableview 禁用tableview滚动时,使用tableview键盘避免的uitextfields,uitableview,keyboard,textfield,tpkeyboardavoiding,Uitableview,Keyboard,Textfield,Tpkeyboardavoiding,我在tableview上有10个文本字段,禁用了tableview滚动 如何处理键盘避免文本字段 以下是我尝试过的 //显示键盘时注册通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) n
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardWillShowNotification
object:nil];
// Register notification when the keyboard will be hide
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification
object:nil];
杂注标记-键盘通知(在发送UIKeyboardDidShowNotification时调用。)
//在发送UIKeyboardWillHideNotification时调用
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
guestRechargeTableView.contentInset = contentInsets;
guestRechargeTableView.scrollIndicatorInsets = contentInsets;
}
这是可行的,但在文本字段上选择并向上移动时不正确。请为该答案或任何其他备选答案提供解决方案
快乐编码
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
guestRechargeTableView.contentInset = contentInsets;
guestRechargeTableView.scrollIndicatorInsets = contentInsets;
}