1

I have made a view controller embedded in a navigation controller. In the view controller, I have inserted a scroll view that contains some buttons and text fields. In the viewDidLoad method, I have inserted the following code to initialize the scrollView:

[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake:(1000, 1000)];

But the view does not scroll. I have tried the same scenario but without embedding the view controller into a navigation controller and it was working. Does anyone know the problem? Thanks.

ASGM
  • 11,051
  • 1
  • 32
  • 53
MahdiS
  • 211
  • 1
  • 2
  • 7

1 Answers1

0

Write this in viewDidAppear. The UI components willnot get set completely in viewDidLoad

Try,

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake:(1000, 1000)];
}

Should work .

DD_
  • 7,230
  • 11
  • 38
  • 59
  • Good, then you can mark this answer as accepted, just check the tick mark to the left side. Thanks – DD_ Apr 08 '13 at 08:15