Graphics Reference
In-Depth Information
self .outerView. layer . transform = outer;
//rotate the inner layer -45 degrees
CATransform3D inner = CATransform3DMakeRotation (- M_PI_4 , 0 , 0 , 1 );
self .innerView. layer . transform = inner;
}
@end
Figure 5.16 The rotated views match the predicted behavior in Figure 5.15.
That seems to have worked as expected. Now let's try it in 3D. We'll modify our code to
rotate the inner and outer views along the Y axis instead of the Z axis, and also add
perspective so we can see more clearly what's going on. We can't use the
sublayerTransform trick from Listing 5.6 because our inner layer is not a direct
sublayer of the container, so we'll just apply the perspective transform separately to each
layer (see Listing 5.8).
Listing 5.8 Opposite Rotation Transforms Around Y Axis
- ( void )viewDidLoad
{
[ super viewDidLoad ];
//rotate the outer layer 45 degrees
Search WWH ::




Custom Search