3

Distorted UIView Screenshot

I tried rotating a UIView using:

view.transform = CGAffineTransform.init(rotationAngle: 45)

only to see the edges of the view looked very distorted. Is this normal? And if it is, are there any workarounds to straighten the edges?

EDIT

I found that adding the piece of code below works the best

view.layer.allowsEdgeAntialiasing = true
Brandon Cornelio
  • 333
  • 3
  • 14

1 Answers1

5

refer this link,

https://stackoverflow.com/a/8313978/6742121,

After that implement this for swift 3.0,

view.layer.borderWidth = 3
view.layer.borderColor = UIColor.clear.cgColor
view.layer.shouldRasterize = true
view.layer.rasterizationScale = UIScreen.main.scale()
Community
  • 1
  • 1
KAR
  • 3,303
  • 3
  • 27
  • 50