strange situation of UITableView when I want to scroll it
- by ivanlw
I'm building an easy app for chatting, each time I type in a sentence, the sentences is added into an array(which used to load the table view in cellForRowAtIndexPath delegate method), then I reload the table view. At last I use the following code to scroll the table view to the bottom
if ([self.chatList numberOfRowsInSection:0] != 0) {
NSUInteger rowCount = [self.chatArray count];
NSIndexPath* indexPath = [NSIndexPath indexPathForRow:rowCount-1 inSection:0];
[self.chatList scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
however, the table view sometimes performs well, sometimes only scrolls to the second to the last line……