Alex
Alex

Reputation: 141

How to Re-Size Label to fit any screen size

Ok, here's what I'm trying to do: I would like to create a scroll view to scroll vertically, in case my text is longer than the screen size (think iPhone 4 vs. iPhone 6).

I've added a scroll view and placed a view within that. I embedded by label for the text within the view.

However, the scroll view currently will scroll only horizontally.

Is there a way to constrain the label width to be the width of the screen? How do I do this?

Upvotes: 0

Views: 75

Answers (2)

adams.s
adams.s

Reputation: 195

If you push the constraint button on the bottom of your storyboard pin it to both the left and right side. Uncheck constraint to margins and pin it both 0. :)

Upvotes: 0

srvv
srvv

Reputation: 623

You can constrain the width to contentview to be equal to scrollview width. And pin the four sides of label to the content view. Also you will need to pin all sides of content view to scrollview, if you haven't already did that.

Upvotes: 1

Related Questions