Reputation:
I understand this code can align the text of a UITableViewCell to the center:
cell.textLabel?.textAlignment = .center
However, I need to align it to the top of the same cell, and also center it. How can I achieve this? UIEdgeContentInsets? Bit confused and I need help. Thanks!
Example, would be something like;
cell.textLabel?.textAlignment = .topCenter
Note; previous line doesn't actually exist as a way to place it in the top center of the cell. But, I am thinking there has to be a way apple provides to do this.
I've read through docs can't find anything -_-. Does anyone have any custom solutions?
Upvotes: 0
Views: 811
Reputation: 535945
Labels do not do vertical alignment; they are vertically centered only. If you don't like that, move the label, or allow its height to fit its contents, or don't use a label.
Upvotes: 1