gpt4 book ai didi

ios - 使用 JSQMessageViewController 删除消息崩溃

转载 作者:行者123 更新时间:2023-11-28 08:41:24 24 4
gpt4 key购买 nike

如何处理JSQMessageController中的删除操作,我已经实现了方法

override func collectionView(collectionView: JSQMessagesCollectionView!, didDeleteMessageAtIndexPath indexPath: NSIndexPath!) {

self.collectionView?.deleteItemsAtIndexPaths([indexPath])

}

也覆盖方法

override func collectionView(collectionView: UICollectionView, shouldShowMenuForItemAtIndexPath indexPath: NSIndexPath) -> Bool {
// Do the custom JSQM stuff
super.collectionView(collectionView, shouldShowMenuForItemAtIndexPath: indexPath)
// And return true for all message types (we don't want the long press menu disabled for any message types)
return true
}

override func collectionView(collectionView: UICollectionView, canPerformAction action: Selector, forItemAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) -> Bool {
super.collectionView(collectionView, canPerformAction: action, forItemAtIndexPath: indexPath, withSender: sender)
return true
}

override func collectionView(collectionView: UICollectionView, performAction action: Selector, forItemAtIndexPath indexPath: NSIndexPath, withSender sender: AnyObject?) {
super.collectionView(collectionView, performAction: action, forItemAtIndexPath: indexPath, withSender: sender)
}

但是我在菜单项上崩溃还有什么要做的工作,任何帮助将不胜感激,提前致谢。

最佳答案

reloadData 有很好的解决方法,但问题出在其他方面......

这是说您更改了 dataSource 数组,并且在调用 deleteItemsAtIndexPaths 之前,collectionView 中没有完成更改。

关于ios - 使用 JSQMessageViewController 删除消息崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36426777/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com