Here is my structure of views for this detail view (blogging application, I want to view the entire post which has dynamic height inside of a scrollview):
UI
in auto layout
frame of scrollview
is decided by constraints between scrollview
and superview
of scrollview
.
contentSize
of scrollview
is decided by constraints between scrollview
and subview
of scrollview
.
you should set the size of singlePostView
. ScrollView
calculate contentSize
from it. (you need to add size constraints explicitly)
CGFloat heightOfSinglePostView = calculate..
[scrollView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[singlePost(heightOfSinglePostView)]|" options:0 metrics: 0 views:viewsDictionary]];