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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:36:28+00:00 2026-06-09T17:36:28+00:00

I have designed a custom UITableViewCell in the same nib file as my UITableView.

  • 0

I have designed a custom UITableViewCell in the same nib file as my UITableView. I am then showing it using the following code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"SearchViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

    // Configure the cell...
    NSInteger section = [indexPath section];

    switch (section) {
        case 0: // First cell in section 1
            return self.priceRangeCell;
            break;
        default:
            // Do something else here if a cell other than 1,2,3 or 4 is requested

            return cell;
            break;
    }

My question is that I am confused on the whole dequeueReusableCellWithIdentifier business. Do I even need the following part ??:

 static NSString *CellIdentifier = @"SearchViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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

Can you see any other problems with my code?

Thanks

  • 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-09T17:36:29+00:00Added an answer on June 9, 2026 at 5:36 pm

    You don’t absolutely have to use the code you mentioned, but it would be bad form not to. If you don’t use that if clause, you will be creating new cells every time you scroll your table instead of reusing old ones — that’s not good for memory usage.

    Secondly, there is something missing from your code — you don’t populate your cell with anything. You return a cell, but you haven’t added any content to it.

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

Sidebar

Related Questions

I have an UITableView showing custom view cells that I've designed in interface builder.
I have designed a custom calendar using html and jQuery. I want to highlight
I have designed a custom file format / network message to reduce size as
I am new to component development. I have designed a file manager using jQuery
I have written a class for UITableViewCell called TaskCell and designed a .xib file
I am creating an application which using custom view and i have designed the
I have designed a custom section handler before but I'm faced with a problem
I have a wpf app that needs to communicate(exchange data) with a custom designed
I have designed a page in Fireworks then imported it to Dreamweaver in CSS
I have designed a database whose MDF file will be copied to remote offices,

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.