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 | 29 | 30 | 31 |
Tags
- 신도림 테크노마트
- 샘플
- Bitcode
- loop
- Example
- IOS
- 페이백
- 보라카이
- Xcode
- 아이폰7
- afterdelay
- 앱스토어
- 신도림
- setting
- swift
- simulator
- push
- LG유플러스
- 공략
- swift3
- GCD
- 스마트폰
- 포켓볼
- UITableView
- error
- Check
- 해몽
- 포켓몬 GO
- 얻는법
- UIView
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