반응형
String의 부분 부분 속성을 바꾸고 싶다면!
let attributedString = NSMutableAttributedString(string: "총 12 건")
attributedString.addAttribute(NSForegroundColorAttributeName, value: UIColor.rgba(123, 124, 125, 255), range: NSRange(location: 0, length: 1))
attributedString.addAttribute(NSForegroundColorAttributeName, value: UIColor.rgba(123, 124, 125, 255), range: NSRange(location: attributedString.length - 1 , length: 1))
lbCount.attributedText = attributedString
이런식으로 쓰면 됩니당
반응형
'개발 > swift' 카테고리의 다른 글
[iOS/Swift] 네이버 아이디로 로그인 하기 (4) | 2017.05.16 |
---|---|
UILabel 안에 아이콘 넣기 (0) | 2016.11.18 |
버튼 이벤트 다른 컨트롤러의 func 불러오기 (0) | 2016.10.21 |
UItableView 회전 (0) | 2016.10.14 |
[Swift]UIGestureRecognizer 참고자료 (0) | 2016.09.28 |
댓글