UIScrollView will not scroll (storyboards)

I am new to Storyboards; I have already done the Interface Builder interface and a lot of manual user interfaces. I searched for this problem, tried the solutions found in other relevant posts to no avail.

I have a view controller with UIScrollView added to Storyboards. ScrollView branch is turned off, the property is synthesized. Scrolling check enabled. Bounces are checked. Even then, there were no signs that the scrolling would take place. When I checked Bounces Vertically, I might at least see scrollable content, but it bounces back after I release. The frame size that I found is set to 320 and 521. I experimented with different heights, but nothing helped. (What should be the size set in the storyboards that will match the older and newer phone sizes?).

In viewDidLoad, I added

[scrollView setContentSize:CGSizeMake(320, 1000)]; 

After that, the log statement confirms that this value is accepted. But that didn't help either.

Someone in one post suggested adding:

 - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self.scrollView setContentSize:CGSizeMake(320, 808)]; } 

This caused the program to crash when loading the controller.

Any help would be greatly appreciated!

Thanks.

+7
ios xcode ios7 uiscrollview
source share
2 answers

Two things turned out to be necessary:

1) Set the scroll height to 480.

2) Add a constraint to the lowest field in scrollview. The limitation was Pin β†’ Bottom Space to Superview.

+15
source share

Just add the following method:

 - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; [self.scrollView setContentSize:CGSizeMake(320, 1700)]; } 

This works great for me.

+6
source share

All Articles