I have a tableView in my view and all works fine, however each custom cell (ToDoListCell) has a text field which I allow users to edit, updating their data. All good and well, my problem occurs whenever trying to scroll to a cell which is going to be hidden by the keyboard.
Note: I adjust the size of the table using the NSNotificationCenter observer methods as the Apple documentation recommends and I know this is not the problem.
- (void)scrollToSelectedCell {
NSIndexPath *currentIndexPath = [NSIndexPath indexPathForItem:0 inSection:0];
while (currentIndexPath.row < self.todos.count) {
ToDoListCell *cell = (ToDoListCell *)[self.table cellForRowAtIndexPath:currentIndexPath];
if (cell.titleField.isEditing == YES) {
[self.table scrollToRowAtIndexPath:currentIndexPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
break;
}
currentIndexPath = [NSIndexPath indexPathForItem:currentIndexPath.row + 1 inSection:0];
}
}
Any idea why it does not scroll to any cell which is not currently on screen?
Thanks,
Ben