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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:24:03+00:00 2026-06-13T07:24:03+00:00

I am getting duplicates of my array, and wrongly displayed cells in this method:

  • 0

I am getting duplicates of my array, and wrongly displayed cells in this method:

Here I am initializing the array, and adding it to the tableView:

NSArray *sectionsArray = [NSArray arrayWithObjects: @"Location", @"Front Post", @"Front Fixing", @"Front Footplate", @"Rear Post", @"Read Fixing", @"Rear Footplate", @"Horizontal Bracing", @"Diagonal Bracing", @"Front Beam", @"Front Lock", @"Rear Beam", @"Rear Lock", @"Guard", @"Accessories", @"Comments", @"Off load ref", @"Loc Empty", @"Loc Affected", nil];
[_tableArray setObject:sectionsArray atIndexedSubscript:2];
[_tableView reloadData];

For some weird reason there are always the 4th object that is messed up, and is either duplicated, or do not have the views from IB. Here is the cellForRowAtIndexPath: method:

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell;
    if (indexPath.section == 2) {
        cell = [tableView dequeueReusableCellWithIdentifier:@"EntryCell"];
        cell.tag = indexPath.row;
        UILabel *label = (UILabel *)[cell viewWithTag:3];
        [label setText:[[_tableArray objectAtIndex:2] objectAtIndex:indexPath.row]];
    }
return cell;
}

I have logged the string [[_tableArray objectAtIndex:2] objectAtIndex:indexPath.row], and it logs the right string.

  • 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-13T07:24:04+00:00Added an answer on June 13, 2026 at 7:24 am

    Remove cell.tag = indexPath.row;

    Because you are reusing the cells and assigning the tag will confuse it. For example, for 2nd row you assign tag = 2 and then when you scroll down you assign tag = 6 to that same row.

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

Sidebar

Related Questions

Possible Duplicates: JavaScript: Getting random value from an array How can I choose an
This program simply is supposed to eliminate duplicates from an array. However, the second
Can anyone tell me what is happenning here? I am getting duplicated session ID's
Possible Duplicate: Getting specific days in a month I've touched on this problem once
When I run the query below I keep getting the values twice. The array
I need to generate an array int[] randomNumbers of random numbers with no duplicates.
Possible Duplicate: Getting a random value from a JavaScript array OK, so I have
Possible Duplicate: Getting the submatrix with maximum sum? Given a 2-dimensional array of positive
I am creating my cells from an array. The last object in my area
Possible Duplicate: C# arrays , Getting a sub-array from an existing array Basically I

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.