0

I am doing a photo application with some editing options so I have a UIView and it is resizable and in that UIView I have UILabel with the UIView bounds as rect. I want to increase the font of text when I resize the view. I tried sizeToFit,factLabel.adjustsFontSizeToFitWidth as TRUE but its not working I want to fill the text to its frame. can anyone help me on this.

Uttam
  • 236
  • 2
  • 15

3 Answers3

3

change the property AutoShrink to minimum font as above Arik Said

Autoshrink

SM18
  • 718
  • 7
  • 15
1

In Storyboard, go to the label's attributes inspector. You should make the font VERY big (think hundreds of points), and in the "Autoshrink" section choose a minimum font size (as small as you want).

Arik Segal
  • 2,963
  • 2
  • 17
  • 29
0

I think you just need to add this:

label.adjustsFontSizeToFitWidth = YES; label.minimumFontSize = 0;

Then the text will automatically resize to fit the label.

Vandana pansuria
  • 764
  • 6
  • 14
  • I already used this but it will FIT the text font to its frame but I want to FILL the text to its frame. – Uttam Dec 07 '16 at 12:11
  • I am looking to fill the text to the frame size like all borders of the text should be filled in the frame – Uttam Dec 07 '16 at 12:21