I'm observing some strange behaviour when working with a UITableViewController
and UITextFields
in the cells.
在单元格中使用UITableViewController和UITextFields时,我观察到一些奇怪的行为。
The UITextFields
delegate is set to the UITableViewController
and when entering editing mode the tableview scrolls to the relevant cell, and does not obscure the input with the keyboard.
UITextFields委托设置为UITableViewController,当进入编辑模式时,tableview会滚动到相关单元格,并且不会使键盘模糊输入。
However, when I present another view controller using
但是,当我使用另一个视图控制器时
[self presentViewController:vc animated:TRUE completion:^() {}];
And later dismiss it with
后来解雇了
[self dismissViewControllerAnimated:YES completion:^{}];
The table stops scrolling and resizing to fit the keyboard.
该表停止滚动和调整大小以适应键盘。
It does not seem to matter where I call the presentViewController
method (in the cell, in the headers or in a toolbar)
在我调用presentViewController方法的位置(在单元格中,在标题中或在工具栏中)似乎并不重要
Any ideas?
有任何想法吗?
UPDATE 1:
更新1:
Delegate for my UITextField is set in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
with cell.textField.delegate = self
我的UITextField的委托设置在 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath with cell.textField.delegate = self
I only override viewWillAppear:(BOOL)animated
:
我只覆盖viewWillAppear:(BOOL)动画:
- (void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[GAI sharedInstance].defaultTracker sendView:@"Some view name"];
}
UPDATE 2
更新2
Manually calling
手动打电话
[self dismissViewControllerAnimated:YES completion:^{
[self viewWillAppear:YES];
}];
Fixes it, but i'd still like some input to why this is necessary ?
修复它,但我仍然喜欢为什么这是必要的一些输入?
1 个解决方案
#1
1
Somewhere in the view hierarchy I had missed a call to [super viewWillAppear:]
.
在视图层次结构的某个地方,我错过了对[super viewWillAppear:]的调用。
#1
1
Somewhere in the view hierarchy I had missed a call to [super viewWillAppear:]
.
在视图层次结构的某个地方,我错过了对[super viewWillAppear:]的调用。