In Objective-C, how can I insert a cell at the first position in UICollectionView? I have a collection of images and I wanted to add a camera button as the first item
Asked
Active
Viewed 390 times
1
-
Possible duplicate of [How to insert Cell in UICollectionVIew Programatically?](http://stackoverflow.com/questions/15572462/how-to-insert-cell-in-uicollectionview-programatically) – Muhammad Zeeshan Jul 20 '16 at 04:34
1 Answers
0
Yes You can add the cell in first position in collection view by this:
[self.collectionView performBatchUpdates:^{
NSDate *newDate=[NSDate date];
[datesArray insertObject:newDate atIndex:0];
[self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:0 inSection:0]]];
} completion:nil];

Saurabh Jain
- 1,688
- 14
- 28