【发布时间】:2009-08-20 22:08:07
【问题描述】:
我正在使用带有自定义单元格的 tableView。当我想使用 navigationController 的 pushViewController 函数显示另一个视图时,我会遍历文本字段并在它们上调用 resignFirstResponder。但是 resignFirstResponder 仅在显示文本字段时才起作用,因此我首先滚动到页面顶部。这是代码:
NSIndexPath *topIndexPath;
topIndexPath = [[NSIndexPath indexPathWithIndex:0] indexPathByAddingIndex:0];
[self.tableView scrollToRowAtIndexPath:topIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
[[self textFieldForRow:0] resignFirstResponder];
[[self textFieldForRow:1] resignFirstResponder];
[[self textFieldForRow:2] resignFirstResponder];
[[self textFieldForRow:3] resignFirstResponder];
这可行,但在此之后,我的 tableView 的来源出现了一些奇怪的问题。我尝试将它的 superviews origin 设置为 0,但这没有帮助。
这里是问题的截图:link
如您所见,我的tableview太大,滚动条到达底部时卡在视图中间。
对不起我的英语,希望你能理解我,
提前致谢!
汉斯
【问题讨论】:
标签: iphone objective-c uitableview