XZ_WeChat
XZ_WeChat copied to clipboard
iOS11系统 ,进入聊天界面的时候,消息Cell不能滚动到最新的消息。。
在iOS11上面, 进入聊天界面发现,Cell不能滚动到最新的一行Cell,
具体代码: if (self.dataSource.count > 0) { [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.dataSource.count-1 inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:NO]; }
可以帮忙看一下嘛。 楼主。
如果你用autolayout,就可以解决这个问题
已经解决了, 在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;