这是操作keyboardWillShowNotification边缘情况
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[nc addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
然后我添加文本框一个UITableViewCell的顺序一个问题:
[textField addTarget:self
action:@selector(textFieldBegin:)
forControlEvents:UIControlEventEditingDidBegin];
[cell addSubview:textField];
在textFieldBegin,我scrollToRowAtIndexPath移动到小区正在编辑。
在keyboardWillShow中,我调整了tableView的框架以允许使用键盘。
textFieldBegin被称为前keyboardWillShow,所以第一次显示它没有空间来滚动。
是否有一种解决这种疏忽的方法?
由于iOS 4.0(我认为),这不再是事实。在iOS 3.0中,我认为textFieldDidBeginEditing:仅在键盘完全出现后才发生,这看起来很愚蠢。 –