1
我想转换一个UIView的方式,增加一个角度(有两个消失点)(见下文)。添加扭曲与消失点投影到CAlayer
我为什么要以这样做的原因是因为我想改变视图的内容是一个UITableView的细胞。
我是新来的这种编码,但我认为我将不得不改变属于子视图的CALayer。但是,我相信,我感兴趣的转换不能使用CATransform3D创建。
有没有人有一个想法如何解决这个问题?
我想转换一个UIView的方式,增加一个角度(有两个消失点)(见下文)。添加扭曲与消失点投影到CAlayer
我为什么要以这样做的原因是因为我想改变视图的内容是一个UITableView的细胞。
我是新来的这种编码,但我认为我将不得不改变属于子视图的CALayer。但是,我相信,我感兴趣的转换不能使用CATransform3D创建。
有没有人有一个想法如何解决这个问题?
看来我已经找到一种方法来规避/解决问题:
使用CATransform3D转换,可以近似通过拆分视图分为两个部分(两个独立UITableViews)华帝点。这些应该由实现必要和协议的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;
}
一旦转换后,两个tableview可以移动,以便它们整齐地合在一起。剩下的唯一工作就是连接一台电视和另一台电视的滚动。我还没有想到这一点。