0
我想改变应该显示在UI中的标签的字体。我用这个行:NSMutableAttributedString中可能的错误
let myAttribute = [ NSFontAttributeName: UIFont(name: "cirth1", size: 18.0)! ]
let buttonTitleNSMut = NSMutableAttributedString(string: "\(buttonTitle)", attributes: myAttribute)
let buttonTitle:String = "\(buttonTitleNSMut)"
let button = createButtonWithTitle(buttonTitle as String)
但我的输出是不是在不同的字体的标签,但一个长字符串的字体的所有的“规格” ...... 我在做什么错?也许最后我说这是一个String
的事实?
你有没有试过检查或打印控制你使用的字符串'“\(buttonTitle)”'?它是否有你期望的文字? – Macondo2Seattle
是的,问题不是'“\(buttonTitle)”' –