Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法刷新UICollectionview iOS中的1个单元格_Ios_Objective C_Iphone_Uicollectionview_Uicollectionviewcell - Fatal编程技术网

无法刷新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之前,必须更新数据源。在你发布的代码中,我看不到有人这样做。