1

I've looked around for an answer here but didn't come along one that really helped me. directing me to a proper answer I may have missed is greatly appreciated too.

I have a label defined in the simplest manner :

    IBOutlet UILabel *eventIDLabel;
    IBOutlet UILabel *eventTitleLabel;
    IBOutlet UILabel *eventDescriptionLabel;

now the description label can vary in content. May have 1 line or multiple lines. I want the label to resize automatically. Now I also want that if more lines than current screen can show, user is enable to scroll down and see the whole content of label.

Very trivial question probably but I am really new and hoping you guys could help.

thanks :D

sys_debug
  • 3,883
  • 17
  • 67
  • 98

2 Answers2

2

You could use a UITextView. UITextView automatically can be scrolled, when the entered text ist to long.

pre
  • 3,475
  • 2
  • 28
  • 43
  • excellent looks like what I really needed. What about justifying it? It is aligned to the left. I can understand if you do not wish to answer 2nd question here – sys_debug Jan 27 '13 at 16:38
  • To justify set textAlignment property of UITextView. But for this kind of questions, you really should just check the documentation. – pre Jan 27 '13 at 16:40
0

You can use [myLabel sizeToFit]

You can also read more about it here

Also if you know it's going to be relatively long, you can consider using TextView which will provide the text scrolling

Hope I helped

Community
  • 1
  • 1
Or Ron
  • 2,313
  • 20
  • 34