How to set UIScrollView Height in Swift

Viewed 18424

I'm using swift to build an application. I want to add some content to my view controller using storyboard.

I already put everything inside the scrollview and set the specific height, but however when I run the application, the scrollview always set longer than the button in the bottom of the view

I want the scroll view stop right after the button

Please kindly help me how to solve this problem

thank you

this is the top of the view

after scrolling (see the blank content after button submit)

after scrolling

for your information, please ignore the white space between 'critics' and submit button, because actually there's UITextView between them but not visible (still try to add some border)

these are my storyboard preview

storyboard 1

storyboard 2

3 Answers

You can try :

   your_scrollView.frame = CGRect(x: 0, y: 0, width: 375, height: 667)
   your_scrollView.contentSize = CGSize(width: 375, height: self.view.frame.size.hight)
Related