【发布时间】:2016-07-20 04:27:16
【问题描述】:
在 Objective-C 中,如何在 UICollectionView 的第一个位置插入一个单元格?我有一组图像,我想添加一个相机按钮作为第一项
【问题讨论】:
标签: ios objective-c xcode uicollectionview
在 Objective-C 中,如何在 UICollectionView 的第一个位置插入一个单元格?我有一组图像,我想添加一个相机按钮作为第一项
【问题讨论】:
标签: ios objective-c xcode uicollectionview
是的,您可以通过以下方式将单元格添加到集合视图的第一个位置:
[self.collectionView performBatchUpdates:^{
NSDate *newDate=[NSDate date];
[datesArray insertObject:newDate atIndex:0];
[self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:0 inSection:0]]];
} completion:nil];
【讨论】: