본문 바로가기
개발노트/iOS

SWIFT : Text에 밑줄(underLine) 주기

by 전지적진영시점 2022. 1. 25.
반응형

또 왔슴니다

이번엔 텍스트 아래에 밑줄을 줄거에요 전 UIButton에다가 사용했습니다

 

아래처럼 선언하시고

let loadUnderLine: [NSAttributedString.Key: Any] = [
 .font: UIFont.systemFont(ofSize: 15),
          .underlineStyle: NSUnderlineStyle.single.rawValue]

         

아래처럼 사용하시면 됩니다!

let attributeString = NSMutableAttributedString(string: "비밀번호 초기화", attributes: loadUnderLine)
 resetBtn.setAttributedTitle(attributeString, for: .normal)

그럼이만!

반응형

댓글