I use image view:
@IBOutlet weak var imageView: UIImageView!
to draw an image, as well as another image that has been rotated. It turns out that the rotated image has very poor quality. In the following image, the glasses in the yellow box do not rotate. The glasses in the red box are rotated 4.39 degrees.

Here is the code I use to draw the glasses:
UIGraphicsBeginImageContext(imageView.image!.size) imageView.image!.drawInRect(CGRectMake(0, 0, imageView.image!.size.width, imageView.image!.size.height)) var drawCtxt = UIGraphicsGetCurrentContext() var glassImage = UIImage(named: "glasses.png") let yellowRect = CGRect(...) CGContextSetStrokeColorWithColor(drawCtxt, UIColor.yellowColor().CGColor) CGContextStrokeRect(drawCtxt, yellowRect) CGContextDrawImage(drawCtxt, yellowRect, glassImage!.CGImage)
How can I rotate and draw glasses without losing quality or getting a distorted image?
user4788711
source share