Reputation: 6465
I am rotating a view by some angle by after rotating I am not getting the smooth edge of the view. Please check the attached image. Is there any way to have a smooth edge of UIView?
I have used the following statement for this purpose.
CGContextRotateCTM(currentContext, RADIANS(-5));
Upvotes: 0
Views: 921
Reputation: 2431
It helps a lot if you set shouldRasterize = true
for the layer of your view.
yourView.layer.shouldRasterize = true
When the value of this property is true, the layer is rendered as a bitmap in its local coordinate space and then composited to the destination with any other content. Shadow effects and any filters in the filters property are rasterized and included in the bitmap. However, the current opacity of the layer is not rasterized. If the rasterized bitmap requires scaling during compositing, the filters in the minificationFilter and magnificationFilter properties are applied as needed.
Upvotes: 2
Reputation: 15881
Try enabling anti-aliasing before rotating:
CGContextSetShouldAntialias(currentContext, true);
Upvotes: 0