最近,我已更新为Xcode 7.0
,以下代码在Swift 1.2
中正常工作,但在Swift 2.0
let messageString = inString
let attributes = [UIFont(): UIFont.systemFontOfSize(15.0)]
let attrString:NSAttributedString? = NSAttributedString(string: messageString, attributes: attributes)
谁知道为什么?
答案 0 :(得分:4)
以这种方式定义属性:
let attributes = [NSFontAttributeName: UIFont.systemFontOfSize(15.0)]