1

I'd like to add a scrollview to my project.

I've added the following code in my file:

- (void)viewDidLoad
{
    [super viewDidLoad];

    [scrollView setScrollEnabled:YES];
    [scrollView setContentSize: CGSizeMake(320, 830)];
}

This works good with xcode 4.3 und IOS 5. But know it doesn't scroll.

If I deactivate Auto Layout in the file inspector it works perfect. But the layout in for iPhone 4 with the smaller display is not correct. The layout in iPhone 5 looks good.

What should I do, when I want don't to enable Auto Layout?

Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
user1355961
  • 51
  • 1
  • 8

1 Answers1

2

Move this constrains to viewDidAppear. I just explained this issue on another question (Autolayout Question).

- (void)viewDidAppear
{
.....
[scrollView setScrollEnabled:YES];
[scrollView setContentSize: CGSizeMake(320, 830)];
....
}
Community
  • 1
  • 1
Idan
  • 9,880
  • 10
  • 47
  • 76
  • Can you give me more details about your issue? – Idan Mar 06 '13 at 09:55
  • 1
    Here is detail of my issue. [link] (http://stackoverflow.com/questions/15237921/uiscrollview-when-autolayout-is-turned-on-storyboard)[/link] – Alok C Mar 06 '13 at 23:40
  • Saw your post, I think you are overriding your settings with "addSubview". Let me know if I was right... – Idan Mar 07 '13 at 10:30