如何將'[String : AnyObject]?'
類型的值轉換爲預期的參數類型'[NSAttributedStringKey : Any]?'
?無法轉換類型'[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()
}
感謝您的幫助:) –