views:

16

answers:

1

Hello guys!

I have a UIImageView add to a UIView as a subview. When I apply a transformation on the UIView's layer the UIImageView gets blurry. Why is that? How can this problem be resolved?

view.layer.position = newPosition;

I apply only this transformation.


Edit: I've tested it and if I apply other transformations like these:

view.layer.transform = newTransform;
view.layer.zPosition = newZPosition;

then the blurry doesn't appear, only if I change the layer position.

A: 

I found the answer. When you set the position of a layer or a view then the origin of it can be float values and this causes the blurry thing. So the solution is to set also the frame's origin after you set the position. You just have to set the frame's position to integer values. On the UI this change won't be seen, but the image will not be blurry.

Infinity