I am trying to force the content size of my UIScrollVIew when loading a container. I find it a lot harder than I guess. I tried to set the content size in both viewDidLoad and viewWillAppear , for example:
-(void)viewWillAppear:(BOOL)animated { CGSize newContentSize = CGSizeMake(scrollView.contentSize.width, scrollView.frame.size.height + 80.0); [scrollView setContentSize:newContentSize]; }
If I set a breakpoint immediately after calling setContentSize , I see that the new content size is really what I set it to.
However, if I then check the size of the content at some arbitrary point after viewWillAppear , for example, scrollViewDidScroll , the size of the content will return to the size of the "actual" content in the scroll, and not the size that I tried to force it to be in viewDidAppear .
Why is this?
source share