Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
xieguangming opened this issue Jan 5, 2018 · 2 comments

Comments

@xieguangming
Copy link

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

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

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

@czl0325
Copy link

czl0325 commented Mar 20, 2018

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

@xieguangming
Copy link
Author

已经解决了,
在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;

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants