UIScrollView won't scroll (Storyboards)

I’m new to Storyboards; I’ve done some Interface Builder before and lots of manual UI positioning. I’ve searched this issue, tried the solutions found in the other relevant posts, to no avail.

I have a view controller with a UIScrollView added in Storyboards. The ScrollView outlet has been connected, the property synthesized. Scrolling Enabled is checked. Bounces is checked. Even then there was no indication that any scrolling would take place. When I checked Bounces Vertically, I could at least see the scrollable content, but it bounces back after I release. The frame size I found set at 320 and 521. I experimented with different heights but nothing helped. (What ought to be the size set in Storyboards that will accommodate the older and newer phone sizes?).

  • Core Data - sharing NSManagedObjects among multiple threads
  • What does “Receiver type 'CALayer' for instance message is a forward declaration” mean here?
  • Empty white space above UITableView inside a UIView
  • Is it possible to record actual sound on the simulator using mic
  • Replacing tel or telprompt to call
  • Forcing a background application to terminate in iOS simulator
  • In viewDidLoad, I added

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

    A log statement afterwards confirms that this value has been accepted. But it didn’t help either.

    Someone in one post suggested adding:

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

    This had the effect of crashing the program when the controller loaded.

    Any help would be greatly appreciated!


    2 Solutions Collect From Internet About “UIScrollView won't scroll (Storyboards)”

    Two things turned out to be necessary:

    1) Set height of scrollview to 480.

    2) Add constraint to the bottommost field in the scrollview. The constraint was Pin >> Bottom Space to Superview.

    Just add the following method:

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

    This is working perfectly for me.