내 Viewcontroller
에있는 UIView
의 원근법을 변경하고 싶습니다. 이 UIView 레이어를 변형해야한다고 생각하지만 어떻게해야할지 모르겠다.Perspective를 제공하기 위해 UIView를 회전하십시오.
나는 다음과 같은 코드를 해봤지만
UIView *myView = [[self subviews] objectAtIndex:0];
CALayer *layer = myView.layer;
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0/-500;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0f * M_PI/180.0f, 0.0f, 1.0f, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
나는 또한 다음 코드를 시도했습니다 작동하지 않습니다 :
-(void)drawRect:(CGRect)rect {
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGAffineTransform transform = CGAffineTransformIdentity;
transform.b = -0.1;
transform.a = 0.9;
CGContextConcatCTM(ctx,transform);
// do drawing on the context
}
를이 너무 :
CALayer *layerA = [[self.view.layer sublayers] objectAtIndex:0];
layerA.transform = CATransform3DConcat(layerA.transform, CATransform3DMakeRotation(DEGREES_TO_RADIANS(45),1.0,0.0,0.0)
둘 중 누구도 일하지 않았습니다. UIView
의 관점을 어떻게 바꿀 수 있습니까?
즉, 예를 들어 설명하겠습니다. 이미지 샘플 코드, 회전 파이 RotationPie sample. 나는 그것의 perpective를 x 또는 z asis로 변경하고 싶다.
제 경우에는 작동하지 않습니다. 컨테이너 뷰처럼 동일한 뷰에 여러 개의 작은 뷰가 함께 있습니다. 원근법 변경을 시도하면 작은 뷰가 서로 분리됩니다. 나는 또한 다른 축의 회전 또는 원근감을 원했습니다. – Aitul
이 샘플 코드를 다운로드하십시오 https://github.com/wczekalski/CDPieMenu CDPieMenu에 대한 시각을 바꾸고 싶습니다. 어떻게 할 수 있습니까? – Aitul
나는 당신의 대답을 좋아해, 나는 애니메이션을하는 법을 안다. 그러나 나는 항상 원근법으로 나타나기를 원한다. 같은 원근감으로 계속하기 위해 우물의 항목을 선택할 때. 예를 들어 45도 시점에서이 바퀴를 원합니다. 원근감이있는 x asis에서 바퀴를 회전하고 45 도의 시점을 계속 유지할 수 있습니다. – Aitul