-1
コンパイラはこのエラーをスローし続けます。「式の種類はコンテキストがなくてもあいまいです。それはそれを投げている:let textFontAttributes = [NSAttributedString。誰かが私を正しい方向に向けることができますか?ありがとう。 NSParagraphStyleAttributeName
へXcode Swift - 属性属性はフォント属性では機能しません
NSFontAttributeName
と
NSMutableParagraphStyle
へ
let textRect = CGRect(x: 50, y: 60, width: 56, height: 35)
let textTextContent = String(globalWorkoutCount) + "/7"
let textStyle = NSMutableParagraphStyle()
textStyle.alignment = .center
let textFontAttributes = [NSAttributedString: UIFont(name: "Avenir-Medium", size: 24)!, NSForegroundColorAttributeName: UIColor.white, NSMutableParagraphStyle: textStyle]
let textTextHeight: CGFloat = textTextContent.boundingRect(with: CGSize(width: textRect.width, height: CGFloat.infinity), options: .usesLineFragmentOrigin, attributes: textFontAttributes, context: nil).height
context.saveGState()
context.clip(to: textRect)
textTextContent.draw(in: CGRect(x: textRect.minX, y: textRect.minY + (textRect.height - textTextHeight)/2, width: textRect.width, height: textTextHeight), withAttributes: textFontAttributes)
context.restoreGState()