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 8044953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:23:38+00:00 2026-06-05T05:23:38+00:00

i have a problem with my UITableview . After scrolling or pushing the switch

  • 0

i have a problem with my UITableview. After scrolling or pushing the switch it starts sometimes mixing up the cells. So you can so the text of one cell shows up in the other. I read a lot about tableViews, but I found nothing that fits for my code.
Here it is:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];

}

    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            cell.textLabel.text = NSLocalizedString(@"Course:",@"Course Section");
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.detailTextLabel.text = entryTableCourseName;

        }

       else if (indexPath.row == 1) {
            cell.textLabel.text = @"Due Date:";
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.detailTextLabel.text = entryTableDueDateString;            }
    }

    else if (indexPath.section == 1) {
        if (indexPath.row == 0) {
            //cell.textLabel.text = NSLocalizedString(@"Title", @"entryTableTaskTitle");
            [cell.contentView addSubview:nameField];

        }

        else if (indexPath.row == 1) {
            [cell.contentView addSubview:TaskView];
        }

    }


    else if (indexPath.section == 2) {

        if (entryTableGradeSwitch.on) {
            if (indexPath.row == 0) {
                cell.textLabel.text = NSLocalizedString(@"Grading", @"GradingCell");
                cell.accessoryView = entryTableGradeSwitch;
            }
            else if (indexPath.row == 1) {
                cell.textLabel.text = NSLocalizedString(@"Options", @"GradingCellOptions");
            }
        }
        else {
            cell.textLabel.text = NSLocalizedString(@"Grading", @"GradingCell");
            cell.accessoryView = entryTableGradeSwitch;
        }
    }

}

I feel like I’m doing something really wrong on setting up the cells.

  • 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-05T05:23:38+00:00Added an answer on June 5, 2026 at 5:23 am

    It’s all due to cell-reusability. There are plenty of posts about this on StackOverflow, and I would recommend that you search for “UITableViewCell Reusability Problems”, and you will come across the solution.

    In short .. What happens here is that when you are scrolling, the cell essentially re-uses the one used before at that indexPath, and cellForRowAtIndexPath assigns a different cell at that indexpath.

    Solution ?

    1. Use different reuse identifiers for each cell.
    2. Subclass your tableViewCell with the view or label that is getting messed up.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem displaying UITableView : Some cells are empty, and content in
I have a UITableView where each cell is an image. Only one cell is
After use UITableView Style Grouped, it have a problem when use selectedBackgroundView with custom
Actually My problem is....suppose i have an UITableView controller when i select a cell
I have a problem with data in UITableView. I have UIViewController, that contains UITableView
i have a problem while loading a UITableView on UITabBarController, i got this error
I have a UITableView with 8 cells(sections) in total in which 6 of them
I'm trying to make my Core data backed UITableView have reorder ability, After implement
I have UItableview where every cell containing 5 cell and these cell are representing
I have a UITableView that displays content programmatically. The cells load fine when first

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.