Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • 12
    you need to remove autolayout Commented Oct 22, 2014 at 5:18
  • 4
    Here's a simple way to solve the problem: stackoverflow.com/a/26632490/636559 Commented Oct 29, 2014 at 14:10
  • 3
    This answer is unnecessarily complicated and it is using a "word around". Please see suggestion below of simply changing the vertical content hugging priority. Doesn't require any code... Commented Jan 23, 2015 at 1:45
  • 1
    [myLabel sizeToFit] is no good in UITableViewCells, since labels here are reused and new texts may not fit. Commented Feb 1, 2016 at 14:47
  • 2
    You still can use AutoLayout and constraints, but assure the [height] will not be fixed. For example: Set Left, Top and Right to equals 8px, but Bottom you can set "Greater Than or Equal" 8px. It'll say to iOS, let my sizeToFit decides the better height for my label. Commented Jan 27, 2017 at 11:55