HardCode
HardCode

Reputation: 2025

UIScrollView not scrolling in xcode 4?

For some reason UIScrollView is not working. It did work before I add the content but after it stop working. I'm stuck can someone help me out!

Here is my code

This is the code for my UIScrollView

@interface EditAccountViewController : UIViewController {
   IBOutlet UIScrollView *svScroller;
}

Here is my view Load code

- (void)viewDidLoad
{
   [super viewDidLoad];
   [svScroller setScrollEnabled:YES];
   [svScroller setContentSize:CGSizeMake(320, 930)];
}

Here is my objects view

Upvotes: 3

Views: 4043

Answers (3)

VICTORGS3
VICTORGS3

Reputation: 203

It works also with that.

To my understanding "autolayout" set constraint after loading the view so the problem could be that you set your constrains on viewDidLoad and just after that "autolayout" changes that. Try to set this constrains on viewDidAppear.

Get it from: scrollview xcode4.5 autolayout. Thanks.

Upvotes: 1

HardCode
HardCode

Reputation: 2025

I resolved the issue. I just bump the height in [svScroller setContentSize:CGSizeMake(320, 1500)]; and It's working fine.

Upvotes: 0

migs647
migs647

Reputation: 847

Always keep in mind that the content view needs to be larger than the UIScrollView instance frame size. If it isn't, it will not enable scrolling.

This applies to UITableView as well. The scrolling for UITableView will not appear unless there are more rows to be displayed than actually are.

Upvotes: 0

Related Questions