1

If I have a viewController with it's XIB, autolayout enabled and the main view (I mean self.view) have a subview in it that have the same width and height as the parent.

If i put this controller inside an other controller (with the addchildController containment pattern), resizing the container of this controller the self.view of the inner controller change but the subview/subviews doesn't resizes! How can I do with that?

With autoresizingmask I know how to do that but I need to use auto layout!

Thanks for the help!

jerrygdm
  • 450
  • 1
  • 7
  • 22

1 Answers1

2

Make sure that the subview has translatesAutoresizingMaskIntoConstraints is set to YES. Then you can simply set the autoresizing mask and iOS will create the appropriate layout constraints for it.

If you are adding the subview via code then you have to manually create and add the constraints between the subview and the container view. Interface Builder can only create such constraints between views that you see in IB.

Cocoanetics
  • 8,171
  • 2
  • 30
  • 57