我有一個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:]'完成你想要的嗎? –