-4

Example:

let dummy = UILabel()
dummy.text = "this is a String"

I want the view to show something like this. Also, is it possible to change the font size of "String" in dummy?

this is a String

MrDank
  • 2,020
  • 2
  • 17
  • 39

1 Answers1

0

You can use NSAttributedString to do that:

let dummy = UILabel()
let theString = "this is a String"
let attributedString = NSMutableAttributedString(string: theString, attributes: [NSFontAttributeName:UIFont.systemFontOfSize(12.0)])
let boldFontAttribute = [NSFontAttributeName: UIFont.boldSystemFontOfSize(24.0)]

attributedString.addAttributes(boldFontAttribute, range: NSMakeRange(10, theString.characters.count))

dummy.attributedText = attributedString
The Tom
  • 2,790
  • 6
  • 29
  • 33