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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:43:13+00:00 2026-05-16T00:43:13+00:00

I’m currently trying to populate an UITableView from a plist downloaded from the internet.

  • 0

I’m currently trying to populate an UITableView from a plist downloaded from the internet. The plist gets loaded into a NSMutableArray and then saved as a file, which works fine.

When trying to populate my UITableView with it though, I run into trouble.

The UITableView displays only the first 8 entries from the *plist file (but there are 98) and then loops through them until its reached 98, so it’s always the same 8 entries instead of 98 different ones.

Here’s my log:

2010-07-20 15:50:19.064 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.065 myCustomers[15221:207] Bob
2010-07-20 15:50:19.068 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.069 myCustomers[15221:207] Jo
2010-07-20 15:50:19.071 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.071 myCustomers[15221:207] Neil
2010-07-20 15:50:19.075 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.075 myCustomers[15221:207] Robert
2010-07-20 15:50:19.077 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.078 myCustomers[15221:207] Jack
2010-07-20 15:50:19.079 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.080 myCustomers[15221:207] John
2010-07-20 15:50:19.081 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.082 myCustomers[15221:207] Ralph
2010-07-20 15:50:19.083 myCustomers[15221:207] New Cell
2010-07-20 15:50:19.084 myCustomers[15221:207] Bart

It creates the new cells, but then stops at 8 and loops. :/

Here’s how I create the cell and get the array’s data:

if (tableView == myTable)
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];

if (indexPath.section == 0) 
{
cell.textLabel.text = [self.dataForTable objectAtIndex:indexPath.row];
    NSLog(@"New Cell");
    NSLog(@"%@",[self.dataForTable objectAtIndex:indexPath.row]);
}
}
return cell;
}

The NSMutableArray “dataForTable” is created as such:

if ([[[NSMutableArray alloc] initWithContentsOfFile:fullFileName] autorelease] != nil)
    {
    self.dataForTable = [[[NSMutableArray alloc] initWithContentsOfFile:fullFileName] autorelease];
    }
    else 
    {
        self.dataForTable = [[NSMutableArray alloc] init]; //create a brand new array if there is no entries file.
    }

The array’s data fetches fine, I’ve checked this in the log and all 98 entries are shown there, but the table view would only use 8.

I’ve been unable to find a solution for this, could anyone please help me out?

Thank you!

  • 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-16T00:43:14+00:00Added an answer on May 16, 2026 at 12:43 am

    In your cellForRowAtIndexPath: method you setup your cell only when you create a new instance of it. While UITableView reuses cells for rows (i.e. cells for rows that become hidden are used for rows that become visible) and you need to setup cell for your row each time – so you should change your code to:

    ... 
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }
    
    if (indexPath.section == 0) 
    {
        cell.textLabel.text = [self.dataForTable objectAtIndex:indexPath.row];
        NSLog(@"New Cell");
        NSLog(@"%@",[self.dataForTable objectAtIndex:indexPath.row]);
    }
    
    return cell;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
i want to parse a xhtml file and display in UITableView. what is the

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.