我怎么能中风和填充NSAttributedString w / UILabel [英] How can I both stroke and fill with NSAttributedString w/ UILabel
本文介绍了我怎么能中风和填充NSAttributedString w / UILabel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以将笔画和填充应用于 NSAttributedString
和 UILabel
?
推荐答案
是的,关键是应用否定值 NSStrokeWidthAttributeName
如果此值为正,您将只能看到笔触而不是填充。
Yes, the key is to apply a Negative value to the NSStrokeWidthAttributeName
If this value is positive you will only see the stroke and not the fill.
self.label.attributedText=[[NSAttributedString alloc]
initWithString:@"string to both stroke and fill"
attributes:@{
NSStrokeWidthAttributeName: @-3.0,
NSStrokeColorAttributeName:[UIColor yellowColor],
NSForegroundColorAttributeName:[UIColor redColor]
}
];
感谢@cacau以下:另见技术问答QA1531
Thanks to @cacau below: See also Technical Q&A QA1531
这篇关于我怎么能中风和填充NSAttributedString w / UILabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文