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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:23:42+00:00 2026-05-18T00:23:42+00:00

I have been working on a problem relating to UITableView and cellForRowAtIndexPath. I want

  • 0

I have been working on a problem relating to UITableView and cellForRowAtIndexPath.

I want to give the user the ability to have a very large number of rows much like a large list of email on iPhone. I discovered this problem when I began to create a class that would queue and dequeue groups of records from the database, as needed, in order to conserve memory. I found that when my UITableViewController loads, it then calls cellForRowAtIndexPath for the typical first 10 indexes (0 through 9). The problem ocurrs when I either click my mouse on the simulator’s black outer surface area or I attempt to scroll down on the UITableView using an upward gesture. At this point, cellForRowAtIndexPath gets called for all remaining indexes. This happens even if there are 1000+ cells. I have attempted recreating a VERY SIMPLE project with only 100 indexes (nothing fancy). It does exactly the same thing.. as soon as I scroll, it calls cellForRowAtIndexPath from positions 10 to 99.

Is this the normal behavior of a UITableView? Does anyone anyone have any ideas why it is inefficiently calling all rows?

I will say that once this initial pass occurs, it seems like it begins to work correctly. I am really puzzled by this because it makes it almost impossible to create a class for queuing and de-queuing records as need.

Here is the code on my much simpler sample project:

// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 return 100;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


 printf("RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = %d\n", indexPath.row);


    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

 cell.textLabel.text = @"Example Text";

 return cell;  
}

Console:

……
Initial Load of View
……

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 0

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 1

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 2

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 3

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 4

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 5

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 6

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 7

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 8

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 9

……
First Scroll Gesture
……

ootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 11

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 12

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 13

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 14

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 15

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 16

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 17

.
.
I removed a few here to shorten it up
.
.

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 97

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 98

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 99

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 10

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 11

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 12

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 13

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 14

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 15

RootViewController, -tableView:cellForRowAtIndexPath; // indexPath.row = 16

(gdb)

Thanks for your help.

Eric

Edit (subsequent day) –> Today I thought to try a real device instead of my simulator. My iPhone 3GS does not reproduce this strange behavior. I believe there might be something wrong with the simulator on my machine. I plan to try another MAC when time permits.

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

    The cause of this problem was an application I have installed on my Mac called Cinch.

    Cinch is a window management application that adds a windows ‘snap’ feature to Mac OS. The program works great otherwise. Whenever I am working with cellForRowAtIndex path, I’ll just have to remember to disable Cinch.

    Sadly, I had to reload my entire computer to figure this out! Hope this is helpful to anyone else experiencing this weird functionality.

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

Sidebar

Related Questions

I am having a very confusing problem with an application I have been working
I have been working on this problem for 2 days now and it's an
I have been working on this problem for a while now. I am trying
I have been working on the following problem from this book . A certain
I have been working for a couple of days on a problem with my
I've been working on this problem for a few hours and have used many
I have a homework problem here I've been working on; here is the description:
I've been working with R just a few months, I have a problem with
Here's a tricky iPhone problem I've been working on. I have three UIScrollViews on
I have been working on this problem for a while but still no joy.

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.