【问题标题】:How can I insert a cell at the first position in UICollectionView?如何在 UICollectionView 的第一个位置插入一个单元格?
【发布时间】:2016-07-20 04:27:16
【问题描述】:

在 Objective-C 中,如何在 UICollectionView 的第一个位置插入一个单元格?我有一组图像,我想添加一个相机按钮作为第一项

【问题讨论】:

标签: ios objective-c xcode uicollectionview


【解决方案1】:

是的,您可以通过以下方式将单元格添加到集合视图的第一个位置:

 [self.collectionView performBatchUpdates:^{
        NSDate *newDate=[NSDate date];
        [datesArray insertObject:newDate atIndex:0];
        [self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:0 inSection:0]]];
    } completion:nil];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多