0

我正在构建一个简单的聊天应用程序,每次我输入一个句子时,这些句子都会被添加到一个数组中(用于在cellForRowAtIndexPath委托方法中加载表格视图),然后我重新加载表格视图。最后我使用以下代码将表格视图滚动到底部

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];
}

但是,表格视图有时表现不错,有时只能滚动到倒数第二行……</p>

4

1 回答 1

0

尝试将 更改scrollPositionUITableViewScrollPositionBottom

于 2012-06-03T06:23:21.880 回答