Skip to main content

Posts

Showing posts with the label catransform3d

Anti-aliasing lines when using CATransform3DRotate

I copied the code from the answer to How do I apply a perspective transform to a UIView? in order to achieve the following image. Note, however, the jagged lines separating the levels. Is there away to perform this kind of perspective transformation in a way that anti-aliases these jagged lines? Edit I've tried the solutions offered by DarkDust in the comments on this post. None seem to work. Here's my code: levelView = [[UIControl alloc] initWithFrame:CGRectMake(100, 60, 160, 230)]; [self addSubview:levelView]; levelView.transform = CGAffineTransformScale(self.transform, .8, .8); CALayer *layer = levelView.layer; //DarkDust's 2nd comment layer.borderWidth = 1; layer.borderColor = [[UIColor clearColor] CGColor]; CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; rotationAndPerspectiveTransform.m34 = 1.0 / 1000; rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0f * M_PI /