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)」' –