Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9247783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:49:12+00:00 2026-06-18T09:49:12+00:00

Newbie question. I have a custom UICollectionView cells with UIImage and UIButton in every

  • 0

Newbie question.
I have a custom UICollectionView cells with UIImage and UIButton in every cell. I need to have array of UIImages that will be filled after cell’s checkbox will be tapped to “checked” state (custom UIButton with appropriate checked/unchecked images connected to IBAction with changing internal cell’s BOOL and checkbox state image). I can’t use -didSelectItemAtIndexPath: for marking because I’m using it for previewing a cell photo. First idea was to add cell image to NSMutableArray by action of tapping checkbox to “checked” state, but if user will want to uncheck checkbox I can’t track what exactly UIImage I need to delete from array. What is most painful method to do this?

PS: it is a listing of my method connected to the checkbox

- (void)theCheckboxTapped:(UIButton*)sender
{
    cell = (CustomCell *)sender.superview.superview;
    if (cell)
    {
        if ([cell isSelected] == NO)
        {
            UIImage *img1 = [UIImage imageNamed:@"checked.png"];
            [[(CustomCell *)cell checkboxSign] setImage:img1 forState:UIControlStateNormal];
        }

        if ([cell isSelected] == YES)
        {
            UIImage *img2 = [UIImage imageNamed:@"unchecked.png"];
            [[(CustomCell *)cell checkboxSign] setImage:img2 forState:UIControlStateNormal];
        }
        cell.isSelected =! cell.isSelected;
    }
}

First idea was to made array of cells and check does BOOl of this cell is equal to YES or NO and add appropriate cell images to array

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:49:13+00:00Added an answer on June 18, 2026 at 9:49 am

    For solving this there are many solutions. But the one which I am explaining, is easy but this consumes some little bit more memory than other methods.

    Steps:-

    1. Create two array with capacity cell count. add all images in this array and add only bool value false initially when no cell is select. For this you can add 0.

      NSMutableArray *imageArray = [[NSMutableArray alloc]init];

      NSMutableArray *boolArray = [[NSMutableArray alloc]init];

    2. When you checked any cell button then replace 0 with 1 in boolArray array, and vice versa.

    3. And reload table. During reloading if value in second array for that position is 0 then no need to pick image from second and if value is 1 then pick image.

    for changing value you can replaceObjectAtIndex method of nsmutablearray.

    Edit:
    No need to do like above.
    one simpler solution is according to your code here.
    As I am seeing that you are able to get cell.
    So you can set tag for imageView and depending to tag you can also get cell’s imageview in which you want to add image.
    For this create imageArray and all images in this. Now add image like:

     if cell.selected = True;
       cell.imageView.image = [imageArray objectAtIndex:@"Cell's tage here or buttons tag here which is equal to indexPath.row"];
    else
       cell.imageView.image = @"Default image or no image here".
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie obj-c question. I have a custom tableview with four custom cells. In every
Really newbie question: I have a .csv file that I need to read. I've
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
MVC newbie question re binders. Supposing I have two strongly typed partial actions that
This is a real newbie question. I have simple app that selects a picture
This is a newbie question: I have a pre-existing function that I would like
I have a newbie question. If in my asp.net application I need to query
I have a newbie question. If I have some global variables that are shared
newbie question,I have the following code where I need to match the data in
C sharp newbie question...I have a simple asp.net form that has a textbox that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.