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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:05:41+00:00 2026-05-23T15:05:41+00:00

I am trying to get the cell detail text to be centered. I have

  • 0

I am trying to get the cell detail text to be centered.

I have read all kinds of posts on this but they all seem to be talking about older versions of IOS. I think I tried every combination of posts but no luck in making it work.

[[cell detailTextLabel] setTextAlignment:UITextAlignmentCenter];

I tried this from willDisplayCell and also in the code below, neither works. Note 2 ways of doing this I tried in both methods.

Does anyone know if this does work or should I create my own center function (method)?

static NSString *CellIdentifier = @"Cell";


    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

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


    cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18.0];


    cell.detailTextLabel.font = [UIFont  systemFontOfSize:16];


    NSMutableDictionary *curRow = [myData objectAtIndex:indexPath.row];
    cell.textLabel.text = [curRow objectForKey:@"Description"];

    cell.detailTextLabel.text = [curRow objectForKey:@"Stats"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.detailTextLabel.textAlignment = UITextAlignmentCenter;
  • 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-23T15:05:41+00:00Added an answer on May 23, 2026 at 3:05 pm

    If Alignment is problem for you then you can create custom labels and add subview to the cell.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
        UILabel *label;
        UILabel *detailLabel;
    
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
            label = [[[UILabel alloc] initWithFrame:CGRectMake(55, 4, 260, 20)] autorelease];
            //make Your alignments to this label
            label.font = [UIFont boldSystemFontOfSize:15.0];
            label.tag=25;
    
            //make Your alignments to this detail label
            detailLabel = [[[UILabel alloc] initWithFrame:CGRectMake(55, 25, 260, 15)] autorelease];
            detailLabel.font = [UIFont systemFontOfSize:13.0];
            detailLabel.tag=30;
            [cell.contentView addSubview:label];
            [cell.contentView addSubview:detailLabel];
        }
        else
        {
            label = (UILabel *)[cell.contentView viewWithTag:25];
            detailLabel = (UILabel *)[cell.contentView viewWithTag:30];
        }
        label.text =[curRow objectForKey:@"Description"];
        detailLabel.text=[curRow objectForKey:@"Stats"];
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i am trying get 2 div-containers which both should contain centered text (Both
I am trying to get position of cell in tableview. from this code i
I am trying to get a random cell in jquery, between 1-16, I have
I'm trying to get the value of a cell in the focused row, but
I'm trying to get a reference to cell and it appears null. If I'm
I'm trying to get the contents of a cell in a row in a
I was trying to implement a UILabel into a cell and what I get
I am trying get all html links within a string and replace them using
I am trying get all html links within a string and replace them using
Trying to get a wildcard search to pick up on any text in org_name

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.