Esquema del texto de UILabel en la subclase de UILabel
Estoy tratando de encontrar una manera de simplemente agregar un esquema / trazo / contorno a mi texto UILabel. Hablando de un trazo alrededor de las letras del texto, no alrededor del fondo de un UILabel.
Estoy usando swift 3 y me gustaría delinear mi texto directamente en mi subclase: UILabel.
Encontré múltiples respuestas que sugieren esta forma de hacer las cosas:
let strokeTextAttributes = [
NSStrokeColorAttributeName : UIColor.black,
NSForegroundColorAttributeName : UIColor.white,
NSStrokeWidthAttributeName : -4.0,
NSFontAttributeName : UIFont.boldSystemFont(ofSize: 30)
]
self.attributedText = NSMutableAttributedString(string: self.text!, attributes: strokeTextAttributes)
Pero la cosa es que no funciona. Mi texto sigue siendo el mismo sin contorno ...
¿Alguien podría ayudarme aquí? Eso sería una gran cosa :)
Muchas gracias. Animo amigos.