Last active
January 9, 2018 05:35
-
-
Save veeneck/fd7928b86d695aae4465 to your computer and use it in GitHub Desktop.
outline text uilabel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if let font = UIFont(name: "DamascusSemiBold", size: 24) { | |
let textFontAttributes = [ | |
NSFontAttributeName : font, | |
// Note: SKColor.whiteColor().CGColor breaks this | |
NSForegroundColorAttributeName: UIColor.whiteColor(), | |
NSStrokeColorAttributeName: UIColor.blackColor(), | |
// Note: Use negative value here if you want foreground color to show | |
NSStrokeWidthAttributeName: -3 | |
] | |
myMutableString = NSMutableAttributedString(string: "hello world", attributes: textFontAttributes) | |
let label = UILabel(frame: CGRect(origin: CGPoint(x:500, y:500), size: CGSize(width: 200, height: 100))) | |
label.attributedText = myMutableString | |
self.view?.addSubview(label) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment