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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:14:07+00:00 2026-06-02T04:14:07+00:00

I am setting up my UITableView using storyboard editor. For creating my cells I

  • 0

I am setting up my UITableView using storyboard editor. For creating my cells I am using the standard delegate method:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchResultCell"];
        if (cell == nil)
        {
        // Do cell setup
        }
    // etc
    return cell;
}

Except when the cell is dequeued the very first time it’s not nil, as it should be. So the code inside the if statement is never executed.

People get this error when their reuse identifiers are inconsistent, so I went ahead and verified that I am using the exact same reuse identifier in my storyboard views as I do in my code. Still facing the issue. I also have several tableviews within the project and each one has a unique reuse identifier. Still no dice. Anyone know anything else that could be wrong here?

  • 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-06-02T04:14:09+00:00Added an answer on June 2, 2026 at 4:14 am

    That’s not how UITableView works anymore. Reading your question, I think you might be confused about how it worked before as well. If not, sorry, the first part of this is just review. 🙂

    Without storyboard cell prototypes

    Here’s how it used to work:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    {
        // If the tableview has an offscreen, unused cell of the right identifier
        // it will return it.
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchResultCell"];
        if (cell == nil)
        {
            // Initial creation, nothing row specific.
        }
    
        // Per row setup here.
    
        return cell;
    }
    

    Here when you create the cell using the reuse identifier, you do only the initial setup here. Nothing specific to this particular row/indexPath.

    Where I’ve put the Per row setup comment you have a cell of the right identifier. It may be a fresh cell, or a recycled cell. You’re responsible for all setup related to this particular row/indexPath.

    Example: if you set the text in some rows (likely) you need to set or clear it in all rows, or text from rows you set will leak through to cells you don’t.

    With storyboard prototypes

    With storyboards, though, the storyboard and table view handle the initial cell creation! This is brilliant stuff. You map out your cell prototypes directly in the tableview when using storyboards, and Cocoa Touch will do the initial creation for you.

    Instead, you get this:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchResultCell"];
        // You'll always have a cell now!
    
        // Per row setup here.
    
        return cell;
    }
    

    You’re responsible for all the same per row setup as before, but you shouldn’t need to write code to build your initial empty cell, either inline or in its own subclass.

    As Ian notes below, you can still use the old approach. Just make sure not to include a cell prototype in the storyboard for the identifier you specify. The view controller won’t be able to build your cell from the cell prototype, dequeueReusableCellWithIdentifier will return nil, and you’ll be exactly where you were before.

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

Sidebar

Related Questions

- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *TelephoneCellId = @TelephoneCellId; UITableViewCell *cell
I am setting the row height of my UITableView using following code [tableView setRowHeight:
When using UITableView, we can reuse its cells using [[ UITableViewCell alloc] initWithStyle: reuseIdentifier:]
I've created a subclass of UITableViewCell . Until now, I've only been using cells
I have a UITableView where some rows are indented using indentationLevel. Cells have the
I'm creating a grid of thumbnail images, using a UITableView where each cell display
I'm setting the tableView cells height dynamically according to labels height and labels height
why does setting a UITableViewCell 's color work in willDisplayCell but not in cellForRowAtIndexPath
I'm using custom headers for my tableview... - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { CustomHeaderController
When setting up a UITableView's data source, I'd be interested to get views on

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.