Clip
Clip

Reputation: 3078

Storyboard UITableViewCell with AutoLayout

I have been trying every combination of constraints to get the UILabel to where they fit to the screen. With no constraints this is how the cell looks when the text is too long, please note that I have auto shrink on.

enter image description here

This is how I have it setup in the storyboard with no constraints.

enter image description here

Does anyone know how I can apply constraints that will properly fill, also I have a disclosure indicator that is not showing up.

Upvotes: 0

Views: 771

Answers (1)

Mike Taverne
Mike Taverne

Reputation: 9352

Set center vertical constraint on the label to the content view.

Set a leading space constraint, label equal to the content view, constant 30 (adjust to taste).

Set a trailing space constraint, label GREATER than or equal to content view, constant 30 (adjust to taste). This will prevent the text from running off the edge of the cell and covering your disclosure indicator.

Do not set width or height constraints on the label.

In the attributes inspector, I suggest use auto shrink with minimum font scale of .75 or so. This will shrink long text to a font size no smaller than 75% of the original, keeping the text readable. If the text is still too long to fit, the text will truncate and you will see ... at the end of the text.

Upvotes: 1

Related Questions