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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:53:28+00:00 2026-05-25T19:53:28+00:00

I have successfully used custom UITableViewCells using separate classes, but I keep thinking there

  • 0

I have successfully used custom UITableViewCells using separate classes, but I keep thinking there is an easier way so I have tried the following. The table builds, but the cells are blank (so presumably my custom cell is not displaying correctly). Any ideas appreciated.

My files are:

@interface RemediesPopUp : UIViewController <UITableViewDataSource, UITableViewDelegate>{

    UITableView *remediesDataTable;
    UITableViewCell *remediesTableCell;  // ** custom cell declared here **

    NSArray *remediesArray;

}

The table controls are:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    remediesTableCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (remediesTableCell == nil) {
        remediesTableCell = [[[UITableViewCell alloc] init] autorelease];
    }

    // Configure the cell.

    return remediesTableCell;

}

I dragged a custom cell object into the XIB file pane (so I have the View and a separate custom cell displayed). I connected the custom cell to File Manager. To test, I pasted a couple of (static) labels onto the custom cell so I could see if it was loading.

The page and table loads just fine, but the cells are blank (white).

Any ideas?

  • 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-25T19:53:28+00:00Added an answer on May 25, 2026 at 7:53 pm

    First off, make sure that your custom cell is a custom subclass (subclass of UITableViewCell) and has its own nib file (for example, don’t integrate it with your table view controller).

    In the nib, select the identity inspector and ensure that your cell’s class is CustomCell (or whatever you called it). Also make sure that under the attributes inspector you set its Identifier to “CustomCellIdentifier” or similar.

    In your table view data source, your tableView:cellForRowAtIndexPath method should contain code similar to this:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CustomCellIdentifier = @"CustomCellIdentifier";    // Same as you set in your nib
    
        CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
        if (cell == nil) {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
    
            for (id oneCell in nib) {
                if ([oneObject isKindOfClass:[CustomCell class]]) {
                    cell = (CustomCell *)oneCell;
                }
            }
        }
    
        // Customise the labels etc...
    
        return cell;
    }
    

    This ensures that your custom cell is loaded directly from its own nib, allowing you to visually lay out any views or labels. The text for these labels can then be set once the appropriate cell has been dequeued/created.

    In your code, your ‘custom’ cell is just a plain UITableViewCell. To customise the cell using interface builder, you need to create your own custom subclass of this.

    EDIT

    For a custom cell that uses only a nib (and not a custom subclass), change the above code example to cast the cell to a plain UITableViewCell, i.e. change CustomCell to UITableViewCell. In Interface Builder assign each of your cell’s custom views (labels etc) with a unique tag.

    With that in place, the code should look something like this:

    #define MyLabelTag  10    // These should match the tags
    #define MyViewTag   11    // assigned in Interface Builder.
    
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CustomCellIdentifier = @"CustomCellIdentifier";    // Same as you set in your nib
    
        UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
        if (cell == nil) {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
    
        for (id oneCell in nib) {
            if ([oneObject isKindOfClass:[UITableViewCell class]]) {
                cell = (UITableViewCell *)oneCell;
            }
        }
    }
    
        // Get references to the views / labels from the tags.
        UILabel *myLabel = (UILabel *)[cell viewWithTag:MyLabelTag];
        UIView *myView = (UIView *)[cell viewWithTag:MyViewTag];
    
        // Customise the views / labels...
        // ...
    
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully used a few custom commands using MVVM-Light, but I want my
I have successfully used Pocket PCs in the past (using the serial port) to
I am using IQueryable<> to build up batching queries. I have used views successfully
I have successfully used the Excel and Word addin templates in Visual studio 2008
I need to used dynamic order query in mysql and i have successfully achieved
What various methods and technologies have you used to successfully address scalability and performance
I have successfully used EF4 to insert rows automatically with a server generated GUID:
I have successfully used a SimpleCursorAdapter to list displayname and value (both in my
I have successfully used the C++ example project to draw graphs from my C++
I have successfully used APNS in iphone app and still have a problem the

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.