Reputation: 6500
I need to allow the user to write text on an NSImage at an angle.The user can specify the angle.
let textsize = text.size(withAttributes: textFontAttributes)
context.saveGState()
context.rotate(by: CGFloat(userangle))
text.draw(at: counterpoint, withAttributes: textFontAttributes)
context.restoreGState()
But this is not producing intended result. The following is what I'm trying to achieve
Upvotes: 0
Views: 98
Reputation: 236370
I guess you are trying to pass an angle using degrees but that method requires you to pass the angle in radians.
To convert your angle in degrees to radians you can check this How can I convert from degrees to radians?
Upvotes: 1