4

How can i programmatically adjust the font size, to make the text fit inside the UILabel, without resize the UILabel?

I already have set this:

imageCell?.imageText.adjustsFontSizeToFitWidth = true

Also in the Storyboard i have set Line Breaks: Word Wrap, Autoshrink: Minimum Font Size: 1 and Lines: 0.

This is how the label looks like: enter image description here

This is the whole label text:

Æ😎🔫👍🏻😎👍🏻😎😎👍🏻😎👍🏻😎👍🏻😎👍🏻😎👍🏻❤️🖕🏻🙃🙌🏻😎🙌🏻😅😀😔👍🏻😎👍🏻😂🎅🏻🙈😔🙌🏻🔫😊🔫😄😀🙃😎😀😂🔫❤️😔🙃💸mzbdjdis # Svsuzi. #vdb #😍😂🖕🏻%<<,#hs. Clcldbs D. Cmcøclco

But still the whole text is not showing in the label. I am not using AutoLayout in my application. Any suggestions?

2
  • 2
    please show an image of your current situation, what you have set to so far should probably work, maybe the constraints of your label are wrong!? Commented Dec 20, 2015 at 19:35
  • @luk2302 - Question updated. Commented Dec 20, 2015 at 19:38

1 Answer 1

4

This is what you need to change.

enter image description here

Setting Minimum Font Size will allow the text to resize as the size of the UILabel frame diminishes.

So, if you want your text to grow in the UILabel, simply set the size of the font itself to be very large, and it will automatically adapt to fit the frame.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.