So, I know there are similar questions to mine, but maybe not exact (so please don\'t mark me down -- just warn me or something). I have searched for days for the solution t
After days of research, it's funny I actually found the solution just minutes after posting this question! So, for my situation I simply had to add this bit of code, and it worked:
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
[self.scrollView setContentSize:CGSizeMake(320, 808)];
}
It seems to be working perfectly now. Please, anyone, let me know if this is a poor way of doing it, because I'm new to this and I would love any help. Otherwise, I'll leave it and hope this can help other people! Thanks!
SOLUTION with Storyboard + Autolayout (no code):
Vertical scrolling example that starts from top-left corner:
width
of the scroll view - either a specific "magic number" or a better way - connect the trailing constraint of a subview that has a set width - if there's non I usually set a label's width = screen width - side paddings => standard(20)+UILabel(280)+standard(20) - this way the scroll view knows exactly its content's width, otherwise you'll get an "ambiguous width" warning.*Needs constraints' adjustments if horizontal scrolling is desired.
your scrollview's frame is not the scrollable size.
Check out contentSize
Set frame to its superview.bounds then set content size to the scroolview's scrollable area.
Also I dont know that the background will scroll.
You will want to add subview's to the scrollview itself.
It should scroll its own subviews. but it will not scroll itself :)