2

I know that we can scroll to the bottom of the UITableView in a regular UITableViewController by using:

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated

Where indexPath can be found by doing a count of how many objects are there in the array of objects. However, in three20.. how do we do the same thing as we don't have the array of objects in the table?

cduhn
  • 17,818
  • 4
  • 49
  • 65
aherlambang
  • 14,290
  • 50
  • 150
  • 253

1 Answers1

2

I don't know if there's something that makes three20 different, but this should work in any UITableViewController subclass:

- (void)scrollToBottom {
    NSInteger section = [self.tableView numberOfSections] - 1;
    NSInteger row = [self.tableView numberOfRowsInSection:section] - 1;
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
    [self.tableView scrollToRowAtIndexPath:indexPath 
                          atScrollPosition:UITableViewScrollPositionMiddle 
                                  animated:YES];
}
cduhn
  • 17,818
  • 4
  • 49
  • 65