0

in the ViewController (principal), i have a UiSrcollView called scroller. It works well when i start the app. But, if i use a segue (to pass to another view controller) the uiscrollview stop to works when i return to the principal.

ps.: I using the auto-layout

Anyone!? Please. i try to implement the content size in the viewDidLoad and in the viewDidApper..

(void)viewDidLoad{
     [super viewDidLoad];
    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320, 2000)];
     scroller.contentSize = CGSizeMake(320, 2000);
}


(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [scroller setScrollEnabled:YES];
    scroller.contentSize = CGSizeMake(320, 2000);
}
Kevin Kunderman
  • 2,036
  • 1
  • 19
  • 30

1 Answers1

1

Try setting it in viewDidLayoutSubviews instead, eg:

(void)viewDidLayoutSubviews {
    [scroller setScrollEnabled:YES];
    scroller.contentSize = CGSizeMake(320, 2000);
}
James
  • 1,118
  • 7
  • 13
  • Thnaks.. that was great! But when i come back to the first ViewController the scroller restart to the top!.. Thanks – user2379431 May 27 '13 at 21:53
  • I think you'll need to store the scroll position in prepareForSegue and set the scroll position in viewWillAppear to maintain the scroll position. – James May 28 '13 at 01:36