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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:18:22+00:00 2026-05-31T17:18:22+00:00

I have to be missing something simple here but it escapes me. After the

  • 0

I have to be missing something simple here but it escapes me. After the user enters a new person to a mutable array I want to update the table. The mutable array is the datasource. I believe my issue lies within cellForRowAtIndexPath.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    TextFieldCell *customCell = (TextFieldCell *)[tableView dequeueReusableCellWithIdentifier:@"TextCellID"];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

    if (indexPath.row == 0) {
        if (customCell == nil) {
            NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"TextFieldCell" owner:nil    options:nil];
            for (id currentObject in nibObjects) {
                if ([currentObject isKindOfClass:[TextFieldCell class]])
                    customCell = (TextFieldCell *)currentObject;
            }
        }
        customCell.nameTextField.delegate = self;
        cell = customCell;
    }

    else {
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];

            cell.textLabel.text = [[self.peopleArray objectAtIndex:indexPath.row-1] name];
            NSLog(@"PERSON AT ROW %d = %@", indexPath.row-1, [[self.peopleArray objectAtIndex:indexPath.row-1] name]);
            NSLog(@"peopleArray's Size = %d", [self.peopleArray count]);
        }
    }

    return cell; 
}

When I first load the view everything is great. This is what prints:

PERSON AT ROW 0 = Melissa
peopleArray's Size = 2
PERSON AT ROW 1 = Dave
peopleArray's Size = 2

After I add someone to that array I get this:

PERSON AT ROW 1 = Dave
peopleArray's Size = 3
PERSON AT ROW 2 = Tom
peopleArray's Size = 3

When I add a second person I get:

PERSON AT ROW 2 = Tom
peopleArray's Size = 4
PERSON AT ROW 3 = Ralph
peopleArray's Size = 4

Why is not printing everyone in the array? This pattern continues and it only ever prints two people, and it’s always the last two people. What the heck am I missing?

—UPDATED—

Ok. My cells are not updating properly and I figured what I asked advice for was going to help me. I guess that wasn’t the main issue.

My issue is that my rows are not printing the proper information. When the view first loads I get:

Melissa
Dave

but after I add Tom, I get:

Melissa         Dave
Melissa    or   Dave
Tom             Tom

and after I add Ralph, I get:

Melissa          ?
Tom        or    ?
Tom              Tom
Ralph            Ralph

What is going on?

  • 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-31T17:18:23+00:00Added an answer on May 31, 2026 at 5:18 pm

    The problem is that you are not updating the label of the cells that are reused. You are setting it only once when the cell is newly created. So Change your code into:

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = [[self.peopleArray objectAtIndex:indexPath.row-1] name];
    NSLog(@"PERSON AT ROW %d = %@", indexPath.row-1, [[self.peopleArray objectAtIndex:indexPath.row-1] name]);
    NSLog(@"peopleArray's Size = %d", [self.peopleArray count]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling I'm missing something pretty simple here but, in this one
I have a feeling that I'm missing something simple here but can't seem to
I hope I am not missing something very simple here. I have done a
i'm missing something fundamental here. i have a very simple custom class that draws
I have to be missing something simple, but I'm really not sure what. I
I am fairly new to WPF and am probably missing something simple here. If
I think I'm missing something very simple here. I have an EF4 ObjectContext that
I am sure I am missing something really simple here but I cant seem
No doubt I'm missing something really simple here but I just can't see the
I HAVE to be missing something really simple here! I have a database in

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.