I have a UIScrollView with several buttons in it. The buttons at the bottom of the scrollview are visible, but don't respond when they're pressed. My problem appears to be the same as the one in this Stackoverflow Question, but the accepted answer does not seem to solve my problem; the frame of the scrollview, the contentSize of the scrollview, and the frame of the view inside the scrollview (which is also the superview of the problematic buttons) all have width 414pt and height 900pt. That should definitely be large enough to encompass the buttons which aren't responding.
I created the scrollview in Interface Builder. The edges of the the container view within the scrollview are pinned to the edged of the scrollview.
I tried adding these lines of code:
scrolling.frame = CGRect(x: 0, y: 0, width: 414, height: 900)
viewInsideScrollview.frame = CGRect(x: 0, y: 0, width: 414, height: 900)
scrolling.contentSize = CGSizeMake(414, 900)
self.view.frame = CGRect(x: 0, y: 0, width: 414, height: 900)
UIScrollView infers its size by the view/views inside of it. You created your views in the interface builder so that could be why the lines of code you added did not work (I am not entirely sure why they did not). However, what will work is setting constraints on your
viewInsideScrollview so that the
scrolling expands to the full content size. For example, if you have 10 buttons in your
viewInsideScrollview, you should set a top space constraint on the top most button, leading and trailing constraints, constraints to give spacing in between buttons, and a bottom space constraint on the bottom most button. The
scrolling will expand to accommodate all of the buttons, and you will be able to select all of them.