如何将类型的值转换'[String : AnyObject]?'为预期的参数类型'[NSAttributedStringKey : Any]?'?
open class func drawText(context: CGContext, text: String, point: CGPoint,
align: NSTextAlignment, attributes: [String : AnyObject]?)
{
var point = point
if align == .center
{
point.x -= text.size(withAttributes: attributes).width / 2.0
}
else if align == .right
{
point.x -= text.size(withAttributes: attributes).width
}
NSUIGraphicsPushContext(context)
(text as NSString).draw(at: point, withAttributes: attributes)
NSUIGraphicsPopContext()
}
Run Code Online (Sandbox Code Playgroud) 无法读取数据,因为它的格式不正确。.string 文件中的文本。请帮帮我
abc = "abc" xyz = "xyz"