How would I go about setting the content size for a scrollview, when the content size is dynamic. I have added all my content to a UIView named “contentView”, then try calling the setcontentsize as below, but this results in no scrolling.
sudo’ish code:
[scrollView setContentSize: contentView.frame.size];
Maybe “contentView” is not stretching its size to fit its children?
Any help would be appreciated.
UIVieworUIScrollViewwill not auto stretch based on content. You have to manually calculate the frames and position it accordingly inside the scrollview and then set thecontentSizeof the scrollview to the biggest possible size that can hold all its subviews.