AndrewSB
AndrewSB

Reputation: 951

Storyboard UIScrollView won't work

I created an UIScrollView inside a UIView and have put a couple labels and buttons in it.

The buttons and labels go on longer than the view frame, so I put this in the viewControllers viewDidLoad, like so:

-(void)viewDidLoad  {
    [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    self.scrollView.contentSize = CGSizeMake(321, 600);
    self.scrollView.frame = self.view.frame;
}

I also set Bounce Vertically to true, so I can bounce the view lower, and it seems as if it's 'scrolling' but then as soon as I let go and it 'unbounces', it goes away.

Why won't my scroll view scroll and stay down?

Upvotes: 0

Views: 221

Answers (2)

Enrico Susatyo
Enrico Susatyo

Reputation: 19800

How are you adding the labels and buttons? If you are using Storyboard and Auto Layout, you will need to set constraints.

Check my answer here on how to do it.

Upvotes: 1

Eliza Wilson
Eliza Wilson

Reputation: 1101

First of all, you should try adding this line:

[self.scrollView setScrollEnabled: YES];

Upvotes: 0

Related Questions