Add a ScrollView to existing View

前端 未结 6 1203
野的像风
野的像风 2020-12-09 08:26

I\'m developing a little app in Swift 2.0. I have a View with the following hierarchy:

Now, the elements placed in this view can\'t be displayed entirely in

6条回答
  •  鱼传尺愫
    2020-12-09 08:50

    It can be done even simpeler than ebby94's answer.

    1) Go to the viewcontroller on the storyboard and click on something in it and press Command + A. This will select all the elements in the view.

    2) Go to Editor -> Embed In -> Scroll View. This will embed all the labels, views, etc into a scrollView.

    3) Set the constraints of the Scroll View to the View's edges.

    And you're good to go! No need for an outlet.

提交回复
热议问题