Mobile App/iOS
Swift 4 - NSMutableAttributedString을 이용하여 Outline text 만들기
bugtype
2019. 3. 9. 15:01
NSMutableAttributedString 을 이용하면 Outline 효과를 줄 수 있다.
NSAttributedStringKey
let myString = "조심해라"
// 1번 아웃라인
let attributes: [NSAttributedStringKey : Any] = [
NSAttributedStringKey.strokeColor: UIColor.red,
NSAttributedStringKey.foregroundColor: UIColor.black,
NSAttributedStringKey.strokeWidth: -3.0,
NSAttributedStringKey.font: UIFont(name: "fontName", size: 80)
]
let customizedText = NSMutableAttributedString(string: myString,
attributes: attributes as? [NSAttributedStringKey : Any] )
textLayer1.string = customizedText
2018.03.02 에 작성된 글입니다.