So I have a UIView called footerView which is added to a UIScrollView. I’ve initialize it as follows:
UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.scrollView_.frameWidth, kFooterViewHeight)];
[footerView setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin];
[footerView setBackgroundColor:[UIColor clearColor]];
self.footerView_ = footerView;
[self.scrollView_ setFooterView_:self.footerView_];
[footerView release];
So initially the scrollView.frameWidth is set to 768. But then at later point it is adjusted to 450. After this happens I tried checking self.footerView.frameWidth and it’s still at 768. Why is this?
I’ve tried calling setNeedsLayout on footerView, I made sure that auto-resize views is set on the UIScrollView, but nothing happens.
Your setting both, flexible margins and flexible width. If you want, that the view resizes, avoid the flexible margins.