Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 10 ScrollView Not Working

New iOS developer, have been following an iOS 9 course on Pluralsight and very simply need to be able to put some Labels in a ScrollView. All I did was select all of the labels and a button and clicked

Editor -> Embed In -> Scroll View

Here's what it looks like:

image

Which worked in the iOS 9 demo. I'm wondering if there is something different about iOS 10 that is not working. When I deploy to the app the labels show but you can't scroll. And yes I know how to scroll in the simulator.

I do see some warnings (which were present in the demo as well). I resolved a couple of them but still didn't work:

image

like image 452
KJ3 Avatar asked Apr 09 '26 01:04

KJ3


1 Answers

You can use "Reset to suggested constraint" option.Which is situated at right bottom corner in the storyboard.

You are not able to scroll because of the constraint so just override the viewDidLayoutSubviews() method into the respective viewController and provide the contentSize to the scrollView

override func viewDidLayoutSubviews() {
    scrollView.contentSize = CGSize(width: self.view.frame.width, height: 1600.0)
}
like image 195
Mayur Rathod Avatar answered Apr 11 '26 19:04

Mayur Rathod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!