Jasper
Jasper

Reputation: 63

Textlabel in tableview cell doesn't resize after refresh

When I initialize a textlabel from a static tableview cell in viewDidLoad, everything is displayed as it should be. However when I change the textvalue some moments later after the press of a button, the text is clipped if it was bigger than the original text set in viewDidLoad. When the new text is shorter, it's being displayed correctly.

Somebody knows a solution for this problem?

-- EDIT --

Solved with:

try calling the label's setNeedsLayout method after changing the text value - that may resize the label. –

Upvotes: 1

Views: 224

Answers (1)

jamihash
jamihash

Reputation: 1900

Set the adjustsFontSizeToFitWidth property of the label to YES. It will make the font smaller when text becomes longer. Also set the minimumFontSize property to a smaller value than the default.

Upvotes: 1

Related Questions