230213 TIL

brick·2023년 2월 12일
0

TIL

목록 보기
21/22
private lazy var secondLabel: UILabel = {
        var label = UILabel()
        
        let text = "test를\n이용해보시겠어요?"
        label.text = text
        label.font = .pretendar(weight: ._400, size: 32.0)
        
        let font = UIFont.cafe24Ssurround(size: 32.0)
        let attributedString = NSMutableAttributedString(string: label.text ?? "")
        attributedString.addAttribute(.font, value: font!, range: (text as NSString).range(of: "test"))
        
        label.attributedText = attributedString
        
        label.textAlignment = .center
        label.numberOfLines = 2
        return label
    }()

0개의 댓글