Cách chuyển đổi giá trị loại '[String : AnyObject]?'
thành loại đối số dự kiến '[NSAttributedStringKey : Any]?'
?Không thể chuyển đổi giá trị của loại '[String: AnyObject]?' để loại đối số dự kiến '[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()
}
Cảm ơn sự giúp đỡ của bạn :) –