0

I need to show a body of text similar to the one shown below and limited to the red non-rectangular area. Rob's answer to this question pretty much answers my question as well, but I also need to truncate at tail of the paragraph when the text is too long.

Extra question: is it also possible to set minimum font size similar to UILabel?

enter image description here

Community
  • 1
  • 1
x89a10
  • 681
  • 1
  • 8
  • 23

1 Answers1

1

Try using NSString::sizeWithFont:constrainedToSize method which is documented here. You can specify the fontsize and maximum size for the text.

You can also calculate the minimum font size using NSString::sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: method.

Luke
  • 11,426
  • 43
  • 60
  • 69
AnkitJain
  • 115
  • 5
  • Ankit, upto my knowledge this works on a standard rectangular area, I need to layout the text on a non-rectangular area as highlighted by the red background above. – x89a10 Jul 31 '13 at 22:00
  • I can think of manipulating your code to divide the area into one or more standard rectangular areas and perform the calculations. – AnkitJain Jul 31 '13 at 22:06
  • Reading following post might help you. http://stackoverflow.com/questions/5158012/rendering-coretext-within-an-irregular-shape – AnkitJain Jul 31 '13 at 22:17