I am trying to use autolayout to automatically resize my popover so that it matches its contents. I have a fixed width popover, but I rely on to calculate the height systemLayoutSizeFittingSize:, passing in my predefined width and zero height, for example. CGSizeMake (190, 0).
ContentController* controller = [ContentController new];
CGSize preferredSize = [controller.view systemLayoutSizeFittingSize:CGSizeMake(190, 0)];
controller.preferredContentSize = preferredSize;
UIPopoverController* popover = [[UIPopoverController alloc] initWithContentViewController:controller];
So far, so good, my current ContentController presentation hierarchy is similar to (setting in Interface Builder):
UILabel - multiline header (dynamically resized)
|
UIImage with fixed width / height (static size)
|
UILabel - multiline body (dynamically resized)
This way, I just include the header / body text, invoke systemLayoutSizeFittingSizeand return a valid size that matches the entire contents of the view.


The problem occurs when I try to put my body shortcut in a UIScrollView. (Both in IB and in code).

systemLayoutSizeFittingSize + .
IB Pure Autolayout.
- , 0.
reset maxPreferredLayoutWidth , , , .
translatesAutoresizingMaskIntoConstraints , .
/ , scrollview - 1000, . .
IB:


, - popover , .
_textContainerHeaderLabel.text = headerText;
_textContainerBodyTextLabel.text = bodyText;
[self.view setNeedsUpdateConstraints]
[self.view layoutSubviews]
, : , UIScrollViews?