Swift - Drawing text with drawInRect:withAttributes:

前端 未结 5 617
自闭症患者
自闭症患者 2020-12-14 08:15

I have strange problem with Xcode 6.1 GM.

let text: NSString = \"A\"
let font = NSFont(name: \"Helvetica Bold\", size: 14.0)

let textRect: NSRect = NSMakeRe         


        
5条回答
  •  执念已碎
    2020-12-14 09:11

    I have this piece of code in my app which works without problems:

        var textAttributes: [String: AnyObject] = [
            NSForegroundColorAttributeName : UIColor(white: 1.0, alpha: 1.0).CGColor,
            NSFontAttributeName : UIFont.systemFontOfSize(17)
        ]
    

提交回复
热议问题