0

I have a UIScrollView that works perfectly when I set its content size in the viewDidAppear method, just like this:

-(void)viewDidAppear:(BOOL)animated{
    [scrollView setScrollEnabled:YES];
    [scrollView setContentSize:CGSizeMake(320, 1500)];
}

But what I actually want to do is to calculate the height of my view after I've added all the different subviews in it, and that happens in a method "getAvis".

But when I add these two EXACT SAME LINES, just like this:

-(void)viewDidAppear:(BOOL)animated{
     [self getAvis];
}
-(void)getAvis{
        [scrollView setScrollEnabled:YES];
        [scrollView setContentSize:CGSizeMake(320, 1500)];
}

It doesn't work anymore...What is the explanation? I really need to be able to set the content size in a separate method to be able to modify the content size whenever I want!

Thanks

el-flor
  • 1,466
  • 3
  • 18
  • 39

1 Answers1

0

Just like @3CC and @YuviGr pointed out, calling [super viewDidAppear:animated] first in the viewDidAppear method worked...Sometimes life is easy and I am stupid. Thanks guys

el-flor
  • 1,466
  • 3
  • 18
  • 39