如何绘制具有固定角度的图层,而不是像这样绘制水平图:
CALayer *layer1 = [CALayer layer];
UIImage *image1 = [UIImage imageNamed:@"cuore2.png"];
[layer1 setPosition:CGPointMake(50,50)];
[layer1 setBounds:CGRectMake(10, 10, 40, 40)];
layer1.contents=(id)image1.CGImage;
[self.view.layer addSublayer:layer1];
非常感谢!
答案 0 :(得分:2)
如果您只想显示按角度α旋转的图层(即不需要任何伪3D透视效果),您可以设置图层的变换:
[CATransaction setDisableActions:YES]; // Disable animation
layer1.transform = CATransform3DMakeRotation(alpha, 0, 0, 1); // Rotate layer