不在viewdidload中时如何自定义标签?

how to customize a label when is not in viewdidload?

I have those variables in collectionviewcell file and I want to change label background and cornerradius but that file doesnt have a viewdidload how can I do that . Thanks for helps.

UIView 子类没有 viewDidLoad 方法,而是使用视图的初始化程序:

class MyCell: UICollectionViewCell {

   override init(frame: CGRect) {
       super.init(frame: frame)
       layoutUI()
   }

   required init?(coder: NSCoder) {
       super.init(coder: coder)
       layoutUI()
   }

   private func layoutUI() { 
        label.layer.cornerRadius = 5
        label.backgroundColor = .blue
   }
}