简体   繁体   English

tableview 滚动到底部问题

[英]tableview scroll to bottom issue

I have created a chat view in which I have used tableview, the basic feature of chat view is to show the latest messages, But table view is not scrolling to last index, it always stuck in the middle我创建了一个聊天视图,其中使用了 tableview,聊天视图的基本功能是显示最新消息,但是 table view 不会滚动到最后一个索引,它总是卡在中间

I have around 60 messages, but it always stuck in the middle.我有大约 60 条消息,但它总是卡在中间。

I already tried with tableview.scrollToLastIndex() tableview.scrollToIndex([IndexPath], animated: true)我已经尝试过 tableview.scrollToLastIndex() tableview.scrollToIndex([IndexPath], animation: true)

but is not working at all但根本不起作用

Try to use this method scrollToRow(at:at:animated:)尝试使用此方法scrollToRow(at:at:animated:)

Example : tableView.scrollToRow(at: index, at: .bottom, animated: true)示例:tableView.scrollToRow(at: index, at: .bottom, animation: true)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM