在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