0

My label.text is very huge. I have ensured that my label will contain any amount of text. I just want my view controller to be scrolled so that I can read my label.

I think it's possible with storyboard itself, but I'm not able to do it.

I tried "editor -> embed in -> scroll view". I also tried adding scrollview to my view controller but nothing worked.

5
  • do you want to scroll horizontally or vertically ? Commented Dec 30, 2015 at 9:14
  • 1
    Then uitextview should do the trick for you :) Commented Dec 30, 2015 at 9:16
  • no i just want the entire view controller to be scrollable :) i know textview will help. but i need this Commented Dec 30, 2015 at 9:19
  • One way to do it is adjust the frame of the of uitextview to contain the entire text . check stackoverflow.com/questions/50467/… for furthur help . Commented Dec 30, 2015 at 9:21
  • drag a scrollview to the screen, then drag a label as a subview of that scrollview Commented Dec 30, 2015 at 9:27

3 Answers 3

1

I see u need to show very long text, then u should use UITextView, its basically scrollView for very long text, and can be resize

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

2 Comments

no i need the entire view controller to be scrollable.
Then u might want to check this out UITextView - Horizontal Scrolling?, it basically explain how to make your Label subview of a ScrollView, if thats what u really needs
1

Maybe you can set the label's property numberOfLines is 0. A Value of 0 means no limit. The text will truncated using the line break mode.

3 Comments

do not forget sizeToFit .
my label is fine.it can accommodate 200 lines or 200 paras as well. the thing is i need to scroll my view controller to see the complete label.text
I see. why not set your scrollView contentSize according to the text height.
0

Please specify more for Whole ViewController scrollable means ..

If you add textView then also your view controller is scrollable if you have scroll view in Main view of View Controller.

Nested scroll works very well and scroll whichever scrollview is dragged by user.

And if you want your UILabel scrollable then you need to set ContentSize of scrollView whenever you change Content(text) of UILabel, and don't forget to set Number Of Lines 0 of your UILabel.

2 Comments

ok keep it like this... Leave out labels text everything.... I just want a white screen that is scrollable..how do i get that?
Add scrollview from storyboard to your main view in ViewController. and set scrollview size to fully cover main view .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.