Search code examples
iosswiftuiviewswift2uilabel

UIView dynamic height depending on Label Height


I have a Label which takes dynamicaly some data from database. These data are strings which can sometimes be 3-4-5 rows etc. So this labe is inside a UIView.

--UIView
  --Label

How can i make the UIView to take the certain height of the Label dynamicaly??


Solution

  • you can just do it with storyboard this pics

    enter image description here

    enter image description here

    set the label height relation to greater than or equal

    and set the view height relation to greater than or equal

    it work like a magic