1

I have a sample app of StudentRecord in which i have a UICollectionview of student's images. I want to add button to last cell and this button should add student's image to the last cell. Following is my existing code, how to modify it-

-(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;
}
2
  • 2
    on Button Clickevent or last cell DidSelect event you can add one more data in existing array and reload your collectionview that add one more record Mar 21, 2016 at 6:02
  • 1
    yes this can be helpful!! i should go by button clickevent
    – vivek
    Mar 21, 2016 at 6:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.