1

i am using a label in my app and given the width of the label as 100 pixel.The content which i place in it would change dynamically.The content sometimes doesn't fit in the label and if the text doesn't fit in, it displays as abcd.... i have given the font size as 14 and ariel as style.

what i require is if the text doesn't fit in ,it should display the remaining text in next line as a textView does.My requirement is to use only a label.I am not ready to reduce the font size i.e 14 .

what i have done is used lineBreakMode and set the number of lines to zero.

self.titleLabel2.lineBreakMode=UILineBreakModeCharacterWrap;
    self.titleLabel2.numberOfLines=0;

can some one suggest me a way to meet my requirement.

TNQ

dinakar

Dinakar
  • 1,198
  • 15
  • 37

1 Answers1

1

What you've done in your example code should work, as long as the label is tall enough to fit all the lines. If you need to resize the label to fit the text dynamically, see Sizing a UILabel to fit?.

Community
  • 1
  • 1
cduhn
  • 17,818
  • 4
  • 49
  • 65