2

I have a simple view with simple background. I need to rotate the view with it's content. The code is here:

    CGAffineTransform r = CGAffineTransformMakeRotation(5 * M_PI / 180.0f);
    backView.transform = r;

I can't find and way make it look nice.

Here is the screenshot:

enter image description here

Buron
  • 1,193
  • 2
  • 13
  • 23
  • Where is the screenshot? – Krrish Mar 14 '12 at 08:46
  • here) sorry, first time upload image here) – Buron Mar 14 '12 at 08:47
  • 2
    possible duplicate of [antialiasing edges of UIView after transformation using CALayer's transform](http://stackoverflow.com/questions/8313804/antialiasing-edges-of-uiview-after-transformation-using-calayers-transform) – jtbandes Mar 14 '12 at 08:48
  • How did you get the blue background: by drawing it in `drawRect` or using a `UIImageView`? – sch Mar 14 '12 at 08:52
  • view.backgroundColor = [UIColor blueColor]; The same will be if i use imageView – Buron Mar 14 '12 at 08:54
  • Really the problem is the same as antialiasing edges of UIView after transformation using CALayer's transform, Thanks will try to solve – Buron Mar 14 '12 at 08:59
  • It works good when i make layer.borderColor = [UIColor ____color____].CGColor; , where ____color_____ is the same as the background, really works, but if image is background i have problems, because clearcolor doesn't work, i look how to fix it now. – Buron Mar 14 '12 at 09:27

2 Answers2

6

You can use the key UIViewEdgeAntialiasing in info.plist:

enter image description here

But as the documentation says, this can have a noticeable impact on performance.

sch
  • 27,436
  • 3
  • 68
  • 83
1

I think I remember reading somewhere about using a 1px clear border which causes the aliasing to appear on the border (which is transparent), and the inner square will be unaffected.

EDIT:

Not sure, but this may have been where I read my previous suggestion. There are also several other solutions, and one of them make work well but still provide acceptable performance, should sch's answer prove too taxing.

FreeAsInBeer
  • 12,937
  • 5
  • 50
  • 82