Gypsa
Gypsa

Reputation: 11314

image coming blurred and screwed after applying rotation on image view

I am stuck with a strange problem that, I have a image view which has to shown at some angle approx 5 degree.For that I rotate my UIImageView to 5 degree but the image in UIImageView not coming proper as it was before transformation.

For more understanding see images

image before rotation image after rotation

You can see the second image is looking like clipped from corners and looks some blur also.

My code for rotation:-

myimageView.transform = CGAffineTransformMakeRotation(radians(5));

Please suggest me how to solve this problem.

Thanks in advance.

Upvotes: 1

Views: 991

Answers (2)

Mundi
Mundi

Reputation: 80273

Have you tried using CGContextRotateCTM(context, radians); and [sourceImage drawInRect:rect];?

Upvotes: 0

Josh Rosen
Josh Rosen

Reputation: 1686

Looks like there are several solutions located in this similar SO Q&A: Any quick and dirty anti-aliasing techniques for a rotated UIImageView?

If it is, in fact, just the edges that are jagged, try adding a 1px transparent border around in image content (this is a suggestion in the above link).

Upvotes: 1

Related Questions