Trong viewDidLoad
, tôi có một cái gì đó như sau để thêm thuộc tính văn bản đến một UITextField
:NSForegroundColorAttributeName không hoạt động trong 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"
Tất cả những thuộc tính dường như hoạt động đúng, trừ NSForegroundColorAttributeName
. Văn bản này xuất hiện trong suốt. Đây có phải là lỗi Swift không?
Văn bản đang được đặt trên một hình ảnh trong một UIScrollView
. Văn bản khi nó xuất hiện:
Memacity của Udacity! – leopic