Automatically Adjust UIView's Height to It's Subview using AutoLayout (Storyboard)

I am using StoryBoards and Autolayout.

Below is the hierarchy:

  • Add a custom selector to a UIBarButtonItem
  • iPhone Detect Volume Keys press.
  • Bug in TWTweetComposeViewController?
  • UIControlEventEditingChanged doesn't get fired when using setText of UITextfield
  • How to set language other than English as the development language and Base localization?
  • Disabling back button and put Cancel button in navigation view controller — like contacts iPhone application
  • - Superview
    -- UIView (ContentView)
    --- UITextField
    --- UITextField
    --- UITextField
    --- UITextField
    

    The UIView(ContentView)’s is constrained to Left, Top, Right of the SuperView with the offset of 20;

    The Bottom of UIView(ContentView) is not constrained to anything.

    I would like the contentView’s height adjusted based on how many textField in it. Any thoughts how I could achieve this using AutoLayout?

    I am very new in Autolayout. Used to do all UI in code.

    Any thoughts?

    Thank you!!

    Solutions Collect From Internet About “Automatically Adjust UIView's Height to It's Subview using AutoLayout (Storyboard)”

    Silly me, found the answer, I simply restrict the height of all the subviews and then constraint the most bottom of the bottom subview to the UIView/ContentView