我正在尝试将此文本的填充设置为白色,但填充是透明的,当我更改NSForegroundAttribureName时,下面的代码无效。
let textAttributes = [
NSFontAttributeName : UIFont(name: "HelveticaNeue-CondensedBlack", size: 40)!,
NSStrokeWidthAttributeName : 3.0,
NSForegroundColorAttributeName : UIColor.whiteColor(),
NSStrokeColorAttributeName : UIColor.blackColor()
]
在viewDidLoad()
中textFieldTop.defaultTextAttributes = textAttributes
如何填充白色字体?
答案 0 :(得分:2)
let textAttributes = [
NSFontAttributeName : UIFont(name: "HelveticaNeue-CondensedBlack", size: 40)!,
NSStrokeWidthAttributeName : -3.0,//Shpuld be in minus
NSForegroundColorAttributeName : UIColor.whiteColor(),
NSStrokeColorAttributeName : UIColor.blackColor()
]
Text becomes invisible when stroke is added
kCTStrokeWidthAttributeName。此属性(按字体点大小的百分比解释)控制文本绘制模式:正值仅影响绘图;负值是笔画和填充。