ios - UITableView无法滚动到底部
PHPz
PHPz 2017-04-18 09:35:59
0
3
402

UITableView无法滚动到底部

在viewdidload 方法里面

/* 首次出现让tableView滚动到底部 /

[self.messageTable setContentOffset:CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX)];

或者 采用了 scrollToRowAtIndexPath 这个方法 同样不管用。
跪求大神帮忙,再此跪了!!!!

这句话,肯定不会滚动到最后一行,说不准是第几行,打印了tablview 的frame 是对的。并且在这句话之前,也reload 了,不知道咋回事有遇到相同问题的人吗?

我做的是一个聊天界面

并且我发送一条消息例如发送一条自定义消息,使用的是滚动到多少行,也显示半个。。。不知道咋回事 如下图

PHPz
PHPz

学习是最好的投资!

reply all(3)
迷茫

Contribute your own answer, dispatch_group_t downloadGroup = dispatch_group_create();

dispatch_group_enter(downloadGroup);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    [self refreshTableView];
    dispatch_group_leave(downloadGroup);
});

dispatch_group_notify(downloadGroup, dispatch_get_main_queue(), ^{
    [self scrollToMessageBottom];
});

Force refresh first, then scroll

阿神

If there is no problem with scrolling, check whether the bottom of your tableView is blocked by the bar at the bottom, and if so, adjust the height.

伊谢尔伦

I used this method in the past and it was often inaccurate. Using scrollToRowAtIndexPath is better than this method

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template