How to set data from bottom to top while chat using firebase

偶尔善良 提交于 2021-01-29 17:34:43

问题


I am working on firebase chat app, i designed my layout and implemented chat module successfully but, the problem is when i send text message it works fine and set text data to bottom of the collectionView but when i close my app and open it again the setting of text data mismatch and the last message comes upward.

I tried all stack overflow questions and others try's but nothing happens any change. can't reverse data


回答1:


Populate your array in reverse order, Because when you inserting data into array you insert last message at zero index of array, so populate array in reverse order on collection view e.g Array.reverse or you can insert data in reverse order into you array, e.g insert last message on last index of array. If you've any issue let me know.



来源:https://stackoverflow.com/questions/57290922/how-to-set-data-from-bottom-to-top-while-chat-using-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!