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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:05:23+00:00 2026-05-16T06:05:23+00:00

The table I’m having problem with is pushed from another table controller, and there

  • 0

The table I’m having problem with is pushed from another table controller, and there is only one section in this table, and I’m using custom cells. Here is the code for numberOfRowsInSection:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSInteger numberOfRows;
if ([imagesArray count] == 0) {
    numberOfRows = 0;
}
else {
    if ([imagesArray count] % 4 == 0) {
        numberOfRows = [imagesArray count] / 4;
    }
    else {
        numberOfRows = ([imagesArray count] / 4) + 1;
    }
}
NSLog(@"numberOfRowsInSection: %d", numberOfRows);
return numberOfRows;
}

The log here always prints the expected number of rows. So far so good. Now let’s take a look at cellForRowAtIndexPath:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"cellForRowAtIndexPath: %@", [indexPath description]);

    ImageTableCell *cell = (ImageTableCell *)[tableView dequeueReusableCellWithIdentifier:@"4ImagesCell"];
    if (cell == nil) {
            cell = [[[ImageTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"4ImagesCell"] autorelease];
    }
    return cell;
}

The console here “always” prints the following:

cellForRowAtIndexPath: <NSIndexPath 0x5a4f2c0> 2 indexes [0, 0]
cellForRowAtIndexPath: <NSIndexPath 0x5a4f2c0> 2 indexes [0, 1]
cellForRowAtIndexPath: <NSIndexPath 0x5a4f2c0> 2 indexes [0, 2]
cellForRowAtIndexPath: <NSIndexPath 0x5a4f2c0> 2 indexes [0, 3]
cellForRowAtIndexPath: <NSIndexPath 0x5a4f2c0> 2 indexes [0, 4]

No matter what the value returned by numberOfRowsInSection is, whether it is a Zero or a 100, the table always asks for 5 rows! I even tried returning a static number in numberOfRowsInSection instead of the current conditions, but it makes no difference for the actual number of cells!

What drives me crazy is that the table does reach the numberOfRowsInSection method before going to cellForRowAtIndexPath!

The only thing I can think of that maybe causing this is that this table controller is pushed from another UITableViewController, but the previous table’s numberOfRowsInSection method is never checked while I’m in this table, I even tried to modify the number of rows in the parent table without any luck.

If there is any kind of info missing please let me know. The project is quit complicated and I can’t think of any other relevant info for this problem.

  • 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-16T06:05:24+00:00Added an answer on May 16, 2026 at 6:05 am

    That’s because the tableview only loads the visible cells. Have you tried scrolling your tableview? I’ll bet if you do that, you’ll see more rows get loaded…

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

Sidebar

Related Questions

Table having boolean column ,boolean should only accept value 0 or 1 but it
Table A has a number of rows, only some of which have (multiple) children
Table name: Employee Column Name: Emp_name Emp_name has this contents: xx\rama, xx\rajesh, xx\vignesh I
Table one: 35 million records Table two: 1,6 million records I'm executing an update
Table: Relatives emp_id dep_id (composite primary key) We have to restrict one employee to
Table Definition Model Definition Code using MyRandomizer.Models; namespace MyRandomizer { class Program { static
Table: I'm wondering if there is a way to convert all my timestamps into
Table has about 8 million rows. There is a non-unique index for X. Showing
Table structure: country season points Current query: SELECT SUM(points) AS total, country FROM table
Table schema is set up something like this: userID Points timestamp 1 40 3

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.