UIView dynamic height depending on Label Height

后端 未结 6 1045
再見小時候
再見小時候 2021-01-15 05:35

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.



        
6条回答
  •  太阳男子
    2021-01-15 06:09

    Below code will resolved your issue :

    //Adjust View Height

    [yourView setFrame:CGRectMake(yourView.frame.origin.x, yourView.frame.origin.y, yourView.frame.size.width, yourLable.frame.size.height + yourLable.frame.origin.y + extraspace)];
    

提交回复
热议问题