グラフィック画面に文字描画をするとき、今は下記のコードを使っています。
override func draw(_ rect: CGRect) { let context = UIGraphicsGetCurrentContext() context!.setFillColor(UIColor.darkGray.cgColor) //矩形 context!.fill(CGRect(x: 0, y: 0, width: 200, height: 300)) //文字属性 let att = [ NSFontAttributeName: UIFont(name: "Courier", size: 20.0)!, NSForegroundColorAttributeName: UIColor.white] //文字描画 NSString(format: "%+4d mm", i).draw(at: CGPoint(x: 200, y: 300), withAttributes: att) }
画面に水平に描画する場合はいいですけど、角度を付きで斜めに描画する場合のどうすればいいのでしょうか?
斜体表示ではなく文字列を回転させる方法を探してます。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー