开发者

iPhone: problem rotating a UIView - doesn't look right

I am adding a simple UIView to my app. This works fine, until I use the 'transform' property to rotate it:

myView = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 100, 100)];
myView.backgroundColor = [UIColor whiteColor];
myView.transform = CGAffineTransformMakeRotation(-0.2);
[self.view addSubview:myView];   //self.view is just another generic UIView

The added view is rotated, but has jagged edges - i.e. the edges have not been anti-aliased. Here's an example of what I mean: aliased vs. anti-aliased edges.

So far, I haven't been able to find any way of fixing it - but surely, it can't be that hard just to rotate a UIView? (The same also applies for a UIImageView, I've tried both).

An开发者_运维技巧y help or ideas would be much appreciated.


I am hard-pressed to explain the WHY of what's going on, but I do know I've seen this issue and one solution is to wrap your view in another or give it some transparent border. So, for example, add the view in another UIView which in inset -4 or so all around.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜