将图像添加到现有的集合视图

时间:2016-03-21 05:55:06

标签: ios uicollectionview

我有一个StudentRecord的示例应用程序,其中我有UICollectionview学生的图像。我想在最后一个单元格中添加按钮,此按钮应将学生的图像添加到最后一个单元格。 以下是我现有的代码,如何修改它 -

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
                 cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    CollectionViewCell *myCell = [collectionView
                                    dequeueReusableCellWithReuseIdentifier:@"MyCell"
                                    forIndexPath:indexPath];

    UIImage *image;
    long row = [indexPath row];

    image = [UIImage imageNamed:studentImages[row]];

    myCell.imageView.image = image;



    return myCell;
}

0 个答案:

没有答案
相关问题