Shadowman
Shadowman

Reputation: 12049

Custom UITableViewCell - UILabel not aligned properly

I am creating a custom UITableViewCell using the Storyboard editor. I've got several components in this cell, but the biggest is a UILabel that is displayed at the top. This label should be left-aligned, however I'm finding that when I run the app in the simulator to test, the text is centered. I've tried specifying the alignment manually, but it always centers itself.

Is there something I need to do to get this working properly in a custom UITableViewCell? I've never encountered anything like this before.

Upvotes: 0

Views: 478

Answers (1)

Fernando Mazzon
Fernando Mazzon

Reputation: 3591

Try using Debug->Color Render layers in the simulator to see if your text is actually centered, or the UILabel moved. Try removing the outlet if any, to prevent anything from tampering with it and see if it helps diagnose. If the colored layer is offset, make sure you added proper constraints to the label (or autoresizing masks). Anchor it to at least left and top and leave the other 2 sides free.

Upvotes: 1

Related Questions