The cells on my UITableViewController have a textField that can be edited. When I edit the textField I need to scroll the tableview so that the row with the current field is above the keyboard. This is the code I am using:
-(void)textViewDidBeginEditing:(UITextView *)textView
{
UITableViewCell *cell = (UITableViewCell*) [[textField superview] superview];
[self.tableView scrollToRowAtIndexPath:[self.tableView indexPathForCell:cell]
atScrollPosition:UITableViewScrollPositionTop
animated:YES];
}
The problem is that it doesn't work for the last couple of cells in my tableview. I am guessing that it has something to do with the contentSize of the tableview. Is there a proper way to adjust the offset of the tableview so that the last cells will scroll above the keyboard?