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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:58:15+00:00 2026-05-12T16:58:15+00:00

I have a UITableView with pagingEnabled. Each cell takes up the viewing area of

  • 0

I have a UITableView with pagingEnabled. Each cell takes up the viewing area of the table. Meaning, each cell is the same height and width as the table. I’m using custom cells that have a name property. I’d like to display the name of the current (viewable) cell in a label. This works fine for the first and last cells but anything inbetween isn’t so easy. The problem is that cellForRowAtIndexPath is called twice for these middle cells. Here’s what it looks like scrolling from the first to last cell and then back. I’ve listed the indexes in order as cellForRowAtIndexPath fires for that row:

Row             indexPath.row
 0                   0         //view loads and table appears
 1                  1,2        //user scrolls to second cell. cellForRowAtIndexPath fires twice.  First time indexPath.row is one and second time it is two.  This causes cell two's name to display in the label, rather than cell one.
 2                  2,3
 3                   3
 //user starts scrolling back to first cell
 2                  1,2 
 1                  1,0
 0                   0

I could set use an NSDate object to detect if I’m in a middle row. By diffing the previous time with current, I’ll know. However, if the user scrolls really fast through the cells, that probably doesn’t work. Is there another way to do it?

I’ve tried using variations of visiblecells properties but that didn’t work. The UITableView will load the next cell even if it isn’t visible, causing it to be part of the visible cells.

  • 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-12T16:58:15+00:00Added an answer on May 12, 2026 at 4:58 pm

    Well, on the off chance that you never figured out a solution, or for whoever comes to this question next, I’ll provide you with the answer you were looking for. UITableView will provide you with the indexPaths you are looking for, and then UITableView will happily provide you with the cells that match those index paths:

    UITableView *tableView = self.tableView; // Or however you get your table view
    NSArray *paths = [tableView indexPathsForVisibleRows];
    
    //  For getting the cells themselves
    NSMutableSet *visibleCells = [[NSMutableSet alloc] init];
    
    for (NSIndexPath *path in paths) {
        [visibleCells addObject:[tableView cellForRowAtIndexPath:path]];
    }
    
    // Now visibleCells contains all of the cells you care about.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 294k
  • Answers 294k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Finally, I went into the C:\windows\assembly and remove the 9.2… May 13, 2026 at 6:45 pm
  • Editorial Team
    Editorial Team added an answer An Introduction to Database Normalization Wiki: Database normalization Database Normalization… May 13, 2026 at 6:45 pm
  • Editorial Team
    Editorial Team added an answer I'm familiar with one situation that causes the database to… May 13, 2026 at 6:45 pm

Related Questions

I have a UITableView with reorderable rows and I'm using the standard UITableViewCell.text property
I have a UITableView with a custom UITableViewCell. In cellForRowAtIndexPath, I assign a font
I have a UITableView With Two Sections. First section has one row and the
I have a UITableView with standard UITableViewCells that contain an image on the left.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.