小编Faw*_*med的帖子

无法转换'[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()
}
Run Code Online (Sandbox Code Playgroud)

nsattributedstring swift swift4 nsattributedstringkey

20
推荐指数
2
解决办法
1万
查看次数

Localization.strings:无法读取数据,因为它的格式不正确

无法读取数据,因为它的格式不正确。.string 文件中的文本。请帮帮我

abc = "abc" xyz = "xyz"

localization ios

1
推荐指数
1
解决办法
2502
查看次数