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;
If Alignment is problem for you then you can create custom labels and add subview to the cell.