Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- error
- UIView
- 아이폰7
- 포켓몬 GO
- GCD
- simulator
- 공략
- Xcode
- IOS
- LG유플러스
- push
- 포켓볼
- 스마트폰
- 얻는법
- 페이백
- swift
- afterdelay
- Check
- setting
- swift3
- loop
- Example
- 해몽
- 보라카이
- 신도림 테크노마트
- Bitcode
- UITableView
- 샘플
- 앱스토어
- 신도림
Archives
- Today
- Total
도래울
swift NSMutableAttributedString text color 본문
extension NSMutableAttributedString {
static public func multicolorTextAttribute(fullText : String, colorText : String, fontColor : UIColor, label : UILabel) -> NSMutableAttributedString {
var mutableString = NSMutableAttributedString()
let range = fullText.rangeOfString(colorText)
let index: Int = fullText.startIndex.distanceTo(range!.startIndex)
mutableString = NSMutableAttributedString(string: fullText as String, attributes: [NSFontAttributeName:label.font])
mutableString.addAttribute(NSForegroundColorAttributeName, value: fontColor, range: NSRange(location:index,length:colorText.characters.count))
return mutableString
}
}
'개발 > iOS' 카테고리의 다른 글
| xcode downloads all version (0) | 2016.09.23 |
|---|---|
| cocoapods 최신버전 업데이트 (0) | 2016.09.20 |
| swift wkwebview alert (0) | 2016.09.09 |
| swift url parsing (0) | 2016.09.09 |
| FBSOpenApplicationErrorDomain error 1 (0) | 2016.09.06 |
Comments