无法刷新UICollectionview iOS中的1个单元格
我在我的无法刷新UICollectionview iOS中的1个单元格,ios,objective-c,iphone,uicollectionview,uicollectionviewcell,Ios,Objective C,Iphone,Uicollectionview,Uicollectionviewcell,我在我的UICollectionView中添加了1个新单元格,但它只有在我向下滚动并滚动到顶部后才会刷新,并且该单元格将出现。我想它会立即出现在插入一个新的细胞,没有滚动。我尝试了以下代码。请帮我改正一下 [self performBatchUpdates:^{ self.arrayWithIndexPaths = [NSMutableArray array]; [self.arrayWithIndexPaths addObject:[NSIndexPath
UICollectionView
中添加了1个新单元格,但它只有在我向下滚动并滚动到顶部后才会刷新,并且该单元格将出现。我想它会立即出现在插入一个新的细胞,没有滚动。我尝试了以下代码。请帮我改正一下
[self performBatchUpdates:^{
self.arrayWithIndexPaths = [NSMutableArray array];
[self.arrayWithIndexPaths addObject:[NSIndexPath
indexPathForRow:_numberOfItemsInCollectionView -1
inSection:SECTION_COUNT-1]];
[self insertItemsAtIndexPaths:self.arrayWithIndexPaths];
//prepare generate XML
[self prepareForGenerateXML:selectedItemsArray andCameraMode:NO];
} completion:nil];
调用
insertItemsAtIndexPaths
之前是否更新了数据源?是的,我在调用insertItemsAtIndexPaths之前更新了数据源。在调用insertItemsAtIndexPaths之前,必须更新数据源。在你发布的代码中,我看不到有人这样做。