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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:41:57+00:00 2026-05-31T09:41:57+00:00

this is a noob question.i subclassed my table view cell in interface builder and

  • 0

this is a noob question.i subclassed my table view cell in interface builder and created a table view.what i want is to change the color of the textlabel to UITableViewCellStyleValue1 color(light blue).since i created the cell in .nib file.i m not able to use cell.detailtextlabel.text.could u guys help me out.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[NSBundle mainBundle] loadNibNamed:@"CCell" owner:self options:nil] objectAtIndex:0];

}
UILabel *lbl=(UILabel*)[cell viewWithTag:1];
UIImageView *imgV = (UIImageView*)[cell viewWithTag:2];
UILabel *label=(UILabel*)[cell viewWithTag:3];

 NSDictionary *dToAccess = [self.listOfItems objectAtIndex:indexPath.row];
[lbl setText:[dToAccess valueForKey:@"title"]];
NSUInteger intVal = [[dToAccess valueForKey:@"rating"] integerValue];
switch (intVal) {
    case 0:
        [imgV setImage:[UIImage imageNamed:@"0star.png"]];
        [label setText:@"Snitt 0"];
        label.textColor=[UIColor blueColor];
        break;
    case 1:
        [imgV setImage:[UIImage imageNamed:@"1star.png"]];
        [label setText:@"Snitt 1"];
        break;
    case 2:
        [imgV setImage:[UIImage imageNamed:@"2star.png"]];
        [label setText:@"Snitt 2"];
        break;
    case 3:
        [imgV setImage:[UIImage imageNamed:@"3star.png"]];
         [label setText:@"Snitt 3"];
        break;
    case 4:
        [imgV setImage:[UIImage imageNamed:@"4star.png"]];
        [label setText:@"Snitt 4"];
        break;
    case 5:
        [imgV setImage:[UIImage imageNamed:@"5star.png"]];
        [label setText:@"Snitt 5"];
        break;
    default:
        break;
}
CGSize size = [lbl.text sizeWithFont:[UIFont boldSystemFontOfSize:16] forWidth:205 lineBreakMode:UILineBreakModeCharacterWrap];
[lbl setFrame:CGRectMake(5, 0, size.width, 43)];

[imgV setFrame:CGRectMake(5+size.width+5, 4, 118, 36)];

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-05-31T09:41:58+00:00Added an answer on May 31, 2026 at 9:41 am

    You can get the detail label cell color for UITableViewCellStyleValue1 by doing:

    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"resuse"];
    UIColor *lightBlueColor = cell.detailTextLabel.textColor;
    

    which can be broken down into it’s RGB values and alpha by doing:

    const float* colors = CGColorGetComponents( lightBlueColor.CGColor );
    

    It’s up to you if you want to hardcode the values in code or just compute it every time. I’d say hardcode would be better.

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

Sidebar

Related Questions

This might be a noob question, but I want to change the userInteractionEnabled property
This may be a noob question but I want to hide the content within
This is a noob question from someone who hasn't written a parser/lexer ever before.
I know this may be a noob question, but it's bugging the heck out
Apologies if this is a slightly noob question, but looking to clarify my thoughts
i think this is a bit of a noob question, but here goes. I
Sorry, this might be a basic/stupid/noob question - I am just trying to tweak
This is a question from a Java noob. I have eclipse open (JRE 1.6),
Apologies for this question but I am a bit of a noob with Delphi.
First of all, I am a WEB NOOB. Which probably explains this question. Anyway,

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.