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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:06:31+00:00 2026-05-17T20:06:31+00:00

I am working on custom cell in uitableview and trying to add uilabels in

  • 0

I am working on custom cell in uitableview and trying to add uilabels in the cell but not able to set text on it. Following is how i am trying to add the cell and also how i am adding the text

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
customCell *cell = (customCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];    
if (cell == nil) {

    cell = [[[customCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
    cell.imageView.image = [UIImage imageNamed:@"iTeam.png"];

}
cell.orangeText1 = @"Mikes Bar";
cell.orangeText1 = @"4.3 mi northeast";
cell.whiteText1 = @"Level";
cell.whiteText1 = @"Freshman";

return cell;

}

My Custom cell class:

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

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
    view.backgroundColor = [UIColor blackColor];
    view.opaque = YES;
    self.backgroundView = view;
    [view release];

    cellImage = [[UIImageView alloc] init];

    myLabel *lblview = [[myLabel alloc] initWithFrame:CGRectMake(self.imageView.frame.size.width+10, 0, 320, 20) OrangeText:orangeText1 WhiteText:whiteText1];
    [self.contentView addSubview:lblview];
    [lblview release];

    lblview = [[myLabel alloc] initWithFrame:CGRectMake(self.imageView.frame.size.width+10, 22, 320, 20) OrangeText:orangeText2 WhiteText:whiteText2];
    [self.contentView addSubview:lblview];
    [lblview release];

    UIImage *image = [UIImage imageNamed:@"acessory.png"];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    CGRect frame = CGRectMake(0.0, 0.0, image.size.width, image.size.height);
    button.frame = frame;
    [button setBackgroundImage:image forState:UIControlStateNormal];
    button.backgroundColor = [UIColor clearColor];
    self.accessoryView = button;
    [button release];

    UIImageView *imagevw = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 320, 8)];
    imagevw.image = [UIImage imageNamed:@"linee.png"];
    [self addSubview:imagevw];
    [imagevw release];

}

return self;

}

Everything else is working fine but i am not getting the text on the label. The label itself is being called from another uiview class.

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-05-17T20:06:32+00:00Added an answer on May 17, 2026 at 8:06 pm

    The standard way of doing this is to expose your UILabels as properties of your cell. I would highly recommend this approach.

    Alternatively, you could implement custom setters for whiteText1 and orangeText1 that then set the text property on the appropriate label. It doesn’t look like you’re keeping a reference to lblview in your initWithStyle, so you’d need to do this as well so you could refer back to it. (Or assign a tag to the label so you can retrieve it from your content view using the tag.)

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

Sidebar

Related Questions

Hi i have a working UITableViewController and UITableView with custom cells but i want
hi i am working on UITableView custom cell for twitter, for each cell i
As I'm working to add custom printing to my application, I've settled on using
I have a custom UITableView cell which has a button and a label. I
I'm having trouble displaying a multi-line UILabel in a custom UITableView cell. I'm currently
hi i am working on Table view, my Table view first custom cell is
I'm working with a UITableView and a custom UITableViewCell . Initially, this had poor
I my outline view, i am adding Custom cell, To drawing custom cell, i
I often find linq being problematic when working with custom collection object. They are
In some instances, I prefer working with custom objects instead of strongly typed datasets

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.