views:

234

answers:

1

In my app I have a UITableView and I want to change the text's alignment to center (not only from the sides like this

     cell.textAlignment = UITextAlignmentCenter;

but from up and down, as well).

Can you help me? thanks in advance!

+1  A: 

Could you please clarify the question? If you use UITableViewCellStyleDefault and increase cell height something like

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  return 100;
}

then the label will be vertically centered without any effort on your part.

Also, cell.textAlignment = … is deprecated in favor of cell.textLabel.textAlignment = ….

Henrik N
Really, maybe it's a bit unclear. I want the rows to be displayed in the center of the screen, so if I have one row, it will be in the center, if I have three rows, the second one will be in the center of the screen and so on
Knodel