I am trying to set attributed text to a label. However, I want to change the size but not want to set the font name, how do I do that?
let myAttributedString = NSMutableAttributedString(string: "Some Text",
attributes: [NSFontAttributeName:UIFont(name: "Georgia",size: 18.0)!])
You can use this,
Your_Label.font.withSize(20)
Your end string will be,
let myAttributedString = NSMutableAttributedString(string: "Some Text", attributes: [NSFontAttributeName:Your_Label.font.withSize(15)])
Get the font name from label.
let myAttributedString = NSMutableAttributedString(string: "Some Text", attributes: [NSFontAttributeName:UIFont(name: label.fontName, size: 18.0)!])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With