我有一个UITableView
,每个UITableViewCell
有一个UITextField
。当选择UITextField
我动画UITableView
到屏幕上,然后我改变UITableView
大小,使用户可以看到UITableViewCell
的UITextField
是英寸如何滚动UITableViewCell到特定位置
目前一切工作和UITableViewCell
在最底层所示,当用户敲回车键时出现问题我尝试设置下一个UITableViewCell
UITextField
作为第一响应者,然后将其滚动到视图....但问题是这个下一个字段尚未加载,所以我无法访问此。
我想知道是否有一种方法可以initally滚动第一个选定的UITableViewCell/UITextField 2 or 3 up from the bottom so when enter is hit there is no worry about the next
的UITextField not being loaded.... currently I have tried writing an off set but it dosnt work if I select a
UITextField`是在屏幕的下半部分......这是代码的样子。
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
CGRect rc = [textField bounds];
rc = [textField convertRect:rc toView:self.finishingTableView];
CGPoint pt = rc.origin;
pt.x = 0;
if(rc.origin.y > 200)
pt.y -= 150;
else
pt.y -= rc.origin.y;
[self.finishingTableView setContentOffset:pt animated:YES];
任何帮助,将不胜感激。
你能用[[UITableView -scrollToRowAtIndexPath:atScrollPosition:animated:]'完成你想要的吗? –