mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-27 05:36:18 +10:00
fix updateConversationCollectionView after send message, use lastDisplayedMessagesRange for new message's indexPath
This commit is contained in:
@@ -504,13 +504,15 @@ class ConversationViewController: UIViewController {
|
||||
if messages.count <= _lastTimeMessagesCount {
|
||||
return
|
||||
}
|
||||
let newMessagesCount = messages.count - _lastTimeMessagesCount
|
||||
let newMessagesCount = Int(messages.count - _lastTimeMessagesCount)
|
||||
|
||||
displayedMessagesRange.length += Int(newMessagesCount)
|
||||
let lastDisplayedMessagesRange = displayedMessagesRange
|
||||
|
||||
displayedMessagesRange.length += newMessagesCount
|
||||
|
||||
var indexPaths = [NSIndexPath]()
|
||||
for i in 0..<newMessagesCount {
|
||||
let indexPath = NSIndexPath(forItem: displayedMessagesRange.length - 1 + Int(i), inSection: 0)
|
||||
let indexPath = NSIndexPath(forItem: lastDisplayedMessagesRange.length + i, inSection: 0)
|
||||
indexPaths.append(indexPath)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user