I realized that if I set the attribute text to UILabel, the predefined font will be changed to the font of the first character of the attributed text. eg:
println(theLabel.font.pointSize);
var styledText = NSMutableAttributedString(string: "$100");
var smallFont = UIFont(name: theLabel.font.fontName, size: theLabel.font.pointSize / 2)!;
styledText.addAttribute(NSFontAttributeName, value: smallFont, range: NSMakeRange(0, 1));
theLabel.attributedText = styledText;
println(theLabel.font.pointSize);
I do not know if this can be called a mistake or not, but in some cases this causes a problem.
Can anyone suggest a clean solution for getting the default font installed in the interface builder?
One solution to reset the font for a predefined font is to set the property text UILabel, because it leads to the fact that it UILabelswitches to plain text mode (no longer with attribute text).
theLabel.text = "";
println(theLabel.font.pointSize);