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

  • SEARCH
  • Home
  • 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 684867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:51:51+00:00 2026-05-14T01:51:51+00:00

i have custom cell with 2 buttons(the function of these buttons is just to

  • 0

i have custom cell with 2 buttons(the function of these buttons is just to disable the button that was pressed).
When i use dequeueReusableCellWithIdentifier in this classic way:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
cell = ((MainCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]);
 if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"MainCell" owner:self options:nil];
 }
    return cell;
}

the UITableView has 1 section, the problem is: on the first cell when i pressed the button to disabled it and than scroll down to show other cells, when i scroll up again the first cell is a new cell and the button is enabled.
I know that reuseIdentifier is used to no recreated a cell if was already created, but in this way i lost all info of the cells that are not more visible.

Any idea?

Thanks in advance

  • 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-05-14T01:51:51+00:00Added an answer on May 14, 2026 at 1:51 am

    I’m having similar issues–I think the problem is that only the visible cells are actually in memory at any given time, and when it redisplays an old cell it actually just dequeues a new one. I think the solution is to use the - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath delegate method:

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
        id objectForCell = [self.arrayOfThingsForTableView objectAtIndex:indexPath.row];
        if (!objectForCell.button1IsEnabled) { 
            cell.button1.enabled = NO; //or something along those lines
        } else {
            cell.button1.enabled = YES; //necessary so that all the other buttons don't disable
        }
    }
    

    If anyone has a better solution, I’d be really happy to hear it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wanna ask this question. Can I use detailTextLabel in a Custom Cell? I
I've created custom column(DataGridViewButtonControlColumn) and cell(ButtonControlCell) classes to hold System.Windows.Forms.Button controls. The buttons get
I have a custom UITableView cell that sports an Image, and a headline. I
I have a custom UIbutton in every cell of my tableview. This UIbutton works
I have a custom UITableViewCell that has 2 buttons and a label on it.
I have a table view that has custom cells. In every cell I have
I have a custom cell renderer set in JTable and it works but instead
I have custom coded several enterprise applications for mid to large organizations to use
I have a few models that need to have custom find conditions placed on
hi i would like to create a custom calendar, this calendar will have custom

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.