Get outlet size within awakeFromNib

前端 未结 2 442
日久生厌
日久生厌 2021-01-18 11:45

I created a custom UICollectionViewCell containing an outlet for a label (placed in the Storyboard). I\'d like to get the height of this label from within the <

2条回答
  •  [愿得一人]
    2021-01-18 12:26

    I am not sure if this is the optimal solution but to make some changes on subviews or getting information like you do, I create a method on the subview like "prepareSubviews" or "refresh" or "populateWithData". After initializing/ loading view from IB, I invoke that method inside "viewDidLoad", at that point the xib file should be loaded and working properly.

提交回复
热议问题