2013-02-28 6 views
1

나는 원근감을 두 개의 소실점과 함께 추가하는 방식으로 UIView를 변형하고 싶습니다 (아래 참조). 나는 변환보기의 내용이 jQuery과의 세포 수를 원하기 때문에CAlayer에 소실점 투영 왜곡 추가

UIView with applied transform

내가보기에이 작업을 수행 할 수있는 이유입니다.

나는 이런 종류의 코딩에 익숙하지 않지만 서브 뷰에 속한 CALayer를 변경해야한다고 가정합니다. 그러나, 나는 CATransform3D를 사용하여 내가 관심있는 변환을 만들 수 없다고 믿는다.

누구든지이 문제에 접근하는 방법을 알고 있습니까?

답변

1

I 문제 해결/회피 할 수있는 방법을 발견 한 것 다음 두 부분 (두 개의 독립적 UITableViews)으로도 분할하여 포인트 유리한에 근접하는 것이 가능하다 CATransform3D 변환을 사용

한다. 이들은 UIViewController (x 코드가 제공하는 UITableViewController가 아닌)에 의해 관리되어야하며 필요한 프로토콜을 구현해야합니다.

그런 다음 viewDidLayoutSubviews : 메서드에서 다음 코드를 사용하여 두 개의 tableviews를 변환합니다.

- (void) viewDidLayoutSubviews { 

    CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; 
    // left View 
    // vantage point 
    rotationAndPerspectiveTransform.m34 = 1.0/-150.0; 
    // Z-rotation of 90° 
    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 90.0 * M_PI/180.0, 0, 0,1); 
    // X-rotation of 25° 
    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, -25.0 * M_PI/180.0, 1, 0,0); 
    // left view 
    [self.view viewWithTag:1].layer.transform = rotationAndPerspectiveTransform; 


    //right view 
    rotationAndPerspectiveTransform = CATransform3DIdentity; 
    rotationAndPerspectiveTransform.m34 = 1.0/-150; 
    // Z-rotation of 90° 
    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 90.0 * M_PI/180.0, 0, 0,1); 
    // X-rotation of 30° 
    rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 25.0 * M_PI/180.0, 1, 0,0); 
    // right view 
    [self.view viewWithTag:2].layer.transform = rotationAndPerspectiveTransform; 
} 

일단 변환되면 두 테이블 뷰가 서로 잘 맞도록 이동할 수 있습니다. 나머지 작업은 한 TV의 스크롤을 다른 TV와 연결하는 것입니다. 아직 그걸 알아 내지 못했어요.