XZ_WeChat icon indicating copy to clipboard operation
XZ_WeChat copied to clipboard

iOS11系统 ,进入聊天界面的时候,消息Cell不能滚动到最新的消息。。

Open xieguangming opened this issue 7 years ago • 2 comments

在iOS11上面, 进入聊天界面发现,Cell不能滚动到最新的一行Cell,

具体代码: if (self.dataSource.count > 0) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.dataSource.count-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; }

可以帮忙看一下嘛。 楼主。

xieguangming avatar Jan 05 '18 08:01 xieguangming

如果你用autolayout,就可以解决这个问题

czl0325 avatar Mar 20 '18 09:03 czl0325

已经解决了, 在new _tableView的时候加上下面的代码. iOS11新出来的坑..记录一下 /*Self-Sizing在iOS11下是默认开启的,Headers, footers, and cells都默认开启Self-Sizing,所有estimated 高度默认值从iOS11之前的 0 改变为UITableViewAutomaticDimension: 解决iOS11 uitableview不能滑动到最后一行的bug */ _tableView.estimatedRowHeight = 0; _tableView.estimatedSectionHeaderHeight = 0; _tableView.estimatedSectionFooterHeight = 0;

xieguangming avatar Mar 29 '18 17:03 xieguangming