AutoLayout setting UILabel height to zero

前端 未结 5 1535
暗喜
暗喜 2021-02-14 01:40

I have a UILabel for item description amongst other views, all laid out using constraints in Interface Builder - you can see all relevant constraints in the image b

5条回答
  •  梦如初夏
    2021-02-14 02:19

    Set 3 constraint

    1.Leading space to superview

    2.Trailing space to superview

    3.Top space to superview

    then

    @property (nonatomic, strong) IBOutlet UILabel *lbl;
    
    - (void) viewDidLoad{
       [self.lbl sizeToFit];
    }
    

提交回复
热议问题