I add a new element at the bottom of the UITableView and after inserting the element, I want the UITableView to scroll to the very bottom level to display the newly inserted element. New items are saved in Core Data, and the UITableView is automatically updated using NSFetchedResultsController.
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { switch (type) { case NSFetchedResultsChangeInsert: NSLog(@"*** controllerDidChangeObject - NSFetchedResultsChangeInsert"); [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
This leads to an error outside the boundaries, I can not get it to work. I can go to the second to the last comment by adjusting the index path line, but I cannot get to the very last element.
Basically, I add a comment to the comment table and after adding a comment, I want the table to scroll to the last comment.
djblue2009
source share