gpt4 book ai didi

ios - UICollectionView deleteItemsAtIndexPaths 失败

转载 作者:行者123 更新时间:2023-12-01 19:07:11 24 4
gpt4 key购买 nike

- (void)deleteCell 
{
[self.collectionViewMenu performBatchUpdates:^{

[self.itemsArray removeObjectAtIndex:1];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
[self.collectionViewMenu deleteItemsAtIndexPaths:@[indexPath]];

} completion:^(BOOL finished) { }];
}

请帮忙解决这个问题,我做错了什么?尝试删除 collectionView 中的项目后出现此错误。
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: <_UICollectionViewItemKey: 0x8d705e0> Type = SV Kind = UICollectionElementKindSectionHeader IndexPath = <NSIndexPath: 0x8d6f4b0> {length = 2, path = 0 - 0})'

最佳答案

我通过删除页眉和页脚大小代表解决了这个问题。问题在于我没有返回页眉或页脚。

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section;

关于ios - UICollectionView deleteItemsAtIndexPaths 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18954295/

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