ios - NSLayoutConstraint best fitting size automatically? -


i've view created in code use in 1 of controllers, created in code, constraints created programatically. now, constraints work perfectly, except view doesn't seem want adopt compressed height (and have no idea how make it). if dont constrain height in controller, ends being longer needs be. know have add constraints subviews, that's problematic because have 2 case scenarios: image lowest subview or uilabel lowest subview shown in image:

how can create constraint make sure views compressed vertically?

you'll need set vertical hugging of enclosing view high value or required (1000). if view want hug content custom view created, you'll need override view's intrinsiccontentsize return correct value (at least height; can return uiviewnoinstrinsicmetric width if need to).


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -