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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:37:15+00:00 2026-06-18T14:37:15+00:00

Sorry, I am missing it. I have a beautiful table with correct (variable) row

  • 0

Sorry, I am missing it. I have a beautiful table with correct (variable) row heights. But all the cells are blank. Three labels should be populated in each cell.

UPDATE: FIX IS BELOW

@implementation MasterTableCell 

@synthesize labelDesc;
@synthesize labelDuration;
@synthesize labelName;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
  self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  if (self) {


    // name
    CGRect frameTextLabel = CGRectMake(8, 2, 244, 25);
    labelName = [[UILabel alloc] initWithFrame:frameTextLabel];
    labelName.lineBreakMode = UILineBreakModeTailTruncation;
    labelName.font = [UIFont boldSystemFontOfSize:17.0];
    labelName.textColor = [UIColor blackColor];

    // description
    labelDesc = [[UILabel alloc] init];
    labelDesc.lineBreakMode = UILineBreakModeWordWrap;
    labelDesc.numberOfLines = 0;
    labelDesc.textColor = [UIColor grayColor];
    labelDesc.font = [UIFont systemFontOfSize:14.0f];
    labelDesc.backgroundColor = [UIColor blueColor];

    // duration
    CGRect frame = CGRectMake(252, 5, 40, 20);
    labelDuration = [[UILabel alloc] initWithFrame:frame];
    labelDuration.font = [UIFont boldSystemFontOfSize:14.f ];
    labelDuration.textAlignment = UITextAlignmentRight;
    labelDuration.backgroundColor = [UIColor redColor]; // to see it

    [self.contentView addSubview:labelName];
    [self.contentView addSubview:labelDesc];
    [self.contentView addSubview:labelDuration];

  }
  return self;
}

@end

And

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  static NSString *CellIdentifier = @"RecipeCell";

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

  Recipe *recipeAtIndex = [sortedArray objectAtIndex:indexPath.row];

  cell.labelName.text = @"Test1";
  cell.labelDesc.text = @"Test2";
  cell.labelDuration.text = [TBCommon formattedStringforDuration:recipeAtIndex.duration withDelimeter:@":"];

  CGRect frameDescLabel = CGRectMake(8, 25, 284, [self heightForDescriptionFrame:recipeAtIndex.description]);
  cell.labelDesc.frame = frameDescLabel;

  return cell;
}

FIX

#import "MasterTableCell.h"

@implementation MasterTableCell : UITableViewCell

@synthesize labelDesc;
@synthesize labelDuration;
@synthesize labelName;

- (void)awakeFromNib
{
    [super awakeFromNib];

// name
CGRect frameTextLabel = CGRectMake(8, 2, 244, 25);
labelName = [[UILabel alloc] initWithFrame:frameTextLabel];
labelName.lineBreakMode = UILineBreakModeTailTruncation;
labelName.font = [UIFont boldSystemFontOfSize:17.0];
labelName.textColor = [UIColor blackColor];

// description
labelDesc = [[UILabel alloc] init];
labelDesc.lineBreakMode = UILineBreakModeWordWrap;
labelDesc.numberOfLines = 0;
labelDesc.textColor = [UIColor grayColor];
labelDesc.font = [UIFont systemFontOfSize:14.0f];

// duration
CGRect frame = CGRectMake(252, 5, 40, 20);
labelDuration = [[UILabel alloc] initWithFrame:frame];
labelDuration.textColor = [UIColor colorWithRed:38.0/255.0 green:111.0/255.0 blue:208.0/255.0 alpha:1];
labelDuration.font = [UIFont boldSystemFontOfSize:14.f ];
labelDuration.textAlignment = UITextAlignmentRight;

[self.contentView addSubview:labelName];
[self.contentView addSubview:labelDesc];
[self.contentView addSubview:labelDuration];
}

@end

And

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

static NSString *CellIdentifier = @"Cell";

MasterTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

Recipe *recipeAtIndex = [sortedArray objectAtIndex:indexPath.row];

cell.labelName.text = recipeAtIndex.name;
cell.labelDesc.text = recipeAtIndex.description;
cell.labelDuration.text = [TBCommon formattedStringforDuration:recipeAtIndex.duration withDelimeter:@":"];

CGRect frameDescLabel = CGRectMake(8, 25, 284, [self heightForDescriptionFrame:recipeAtIndex.description]);
cell.labelDesc.frame = frameDescLabel;

return cell;

}
  • 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-18T14:37:16+00:00Added an answer on June 18, 2026 at 2:37 pm

    If you’re using Storyboards, initWithStyle will never be called. Move the label creation code into awakeFromNib.

    You can get rid of the whole if (cell == nil) part too because dequeueReusableCell will ALWAYS return a cell.

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

Sidebar

Related Questions

Sorry to ask something that others have already asked. But when I use the
Sorry for adding this to the missing right parenthesis pool on the site but
Sorry for this simple question, but i'm missing the forest through the trees. These
EDIT : the function creation was missing, sorry about that I have a T-SQL
Sorry if this is answered somewhere due to me missing something obvious, but I've
I'm sorry for the question, but I'm new with the BLL :( I have
This is probably a simple question that I am just missing but I have
Sorry if this is incredibly obvious, but I have no idea why this isn't
I am sorry this resembles to homework. But, I have just been unable to
Sorry gals & guys for a potentially dumb question but I have been looking

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.