我正在处理ios swift 4中的照片编辑应用程序,我想提供以下功能
在图像中我想为Text提供内部颜色和外部颜色。但我对此并不了解。我怎么能实现它是否有任何功能库
我尝试了一些字体属性,因为我使用了阴影颜色和背景颜色,但它不符合我的要求。 请帮忙!
答案 0 :(得分:1)
您可以使用NSAttributedString
:
NSAttributedString(string: "Testing", attributes: [
.foregroundColor: #colorLiteral(red: 0.980392158, green: 0.5607843399, blue: 0, alpha: 1),
.strokeColor: #colorLiteral(red: 0.03990633413, green: 0.1469032466, blue: 0.7415332794, alpha: 1),
.strokeWidth: -3,
.font: UIFont.systemFont(ofSize: 30)])
这会产生一个如下所示的字符串: