美文网首页我的收藏
tableView默认显示最底下

tableView默认显示最底下

作者: 今年27 | 来源:发表于2018-07-31 11:25 被阅读6次

最近用tableview默认滑到最底下

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.isScrollToBottom == NO) {
        [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.messageArray.count-1 inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO];
        
        if (indexPath.row == self.messageArray.count-1) {
            
            self.isScrollToBottom = YES;
        }
    }

}

相关文章

网友评论

    本文标题:tableView默认显示最底下

    本文链接:https://www.haomeiwen.com/subject/dpicvftx.html