UILabel’s sizeToFit/sizeThatFits ignore the numberoflines property

I had the same problem, size that fits simply ignores the size… /:
I ended up using:

CGRect textSize = [UILabel textRectForBounds:CGRectMake(0, 0, 300, CGFLOAT_MAX) 
                      limitedToNumberOfLines:3];

Works like a charm… 🙂

The documentation says you shouldn’t call it directly, but i’ve been using it for a while, with approved submitted apps, and everything is just awesome… 🙂

Leave a Comment