Automatically Adjust UIView's Height to It's Subview using AutoLayout (Storyboard)
I am using StoryBoards and Autolayout.
Below is the hierarchy:
- 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.
- Centering subview's X in autolayout throws “not prepared for the constraint”
- Center 4 images with constraints autolayout
- Horizontal center constraint issue in ios?
- Constraints for Centering One Button When the Other Is Hidden
- An issue with Content Hugging and Content Compression Resistance, Autolayout Constraints
- Expandable UITableView Cell using Autolayout results in UIViewAlertForUnsatisfiableConstraints
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
- NSFastEnumeration in Swift 3
- WKWebView screenshot not completely rendering full page height
- Swift UnsafeMutablePointer<Unmanaged<CFString>?> allocation and print
- Objective-C UILabel as HyperLink
- Making a drop down list using swift?
- setNeedsStatusBarAppearanceUpdate unrecognized selector
- Is NSDocument and CoreData a possible combination, or is NSPersistentDocument the only way?
- iPhone iOS saving data obtained from UIImageJPEGRepresentation() fails second time: ImageIO: CGImageRead_mapData 'open' failed
- XCode/PhoneGap – Apple Mach-O Linker Error
- How to apply text shadow to UITextView?
- iOS Replace char in uitextfield
- Large cells in a UICollectionView getting removed while the cell is still displayed
- Create UICollectionViewCell subclass with xib
- Adding autolayout constraints to navigation controller programatically
- Core plot: Library binary missing