在viewDidLoad
,我有类似以下内容添加文本属性的UITextField
:NSForegroundColorAttributeName在Swift中不起作用?
let textAttributes = [
NSForegroundColorAttributeName: UIColor.whiteColor(),
NSStrokeColorAttributeName: UIColor.blackColor(),
NSFontAttributeName: UIFont(name: "HelveticaNeue-CondensedBlack", size: 40)!,
NSStrokeWidthAttributeName: 1.0
]
self.textField.delegate = self
self.textField.defaultTextAttributes = textAttributes
self.textField.text = "Top text field"
所有这些属性似乎正常工作,除了NSForegroundColorAttributeName
。该文本显示为透明。这是一个Swift错误吗?
将文本放在UIScrollView
中的图像上。因为它出现文字:
Udacity的MemeApp! – leopic