In the preface, itβs not me who is losing sight of the screen because I did the wrong conversion, it is weirder.
The problem is that if I use the .m34 transform to achieve the perspective I need, the view hierarchy breaks, but it removes the transform and draws correctly.
Here is an example.
I have a background image (subviewOne), a menu (subviewTwo), and an object on top of everything I apply CATransform3D to (subviewThree).
Simple code:
CALayer *layer = subviewThree.layer; CATransform3D perspectiveTransform = CATransform3DIdentity; perspectiveTransform.m34 = -1.0 / 500; layer.transform = perspectiveTransform;
Prior to applying this code, the presentation hierarchy was and remains on iOS 5:
(bottom to top) subviewOne->subviewTwo->subviewThree
After applying it, I get:
(bottom to top still) subviewTwo->subviewOne->subviewThree
Now subviewThree still has the perspective transform applied to it and is in the right place, on top of everything else, just like on iOS5. However, Menu / subviewTwo is now hidden by the background image / subviewOne, and none of this will have it drawn on top of subviewOne. No amount of insertSubviewAtIndex :, bringSubviewToFront, sendSubviewToBack, etc., Draw the picture correctly.
This is incredibly unusual, especially because views that are out of order are NOT , if any CATransform3D is applied to them.
I tested this myself in two different applications and on 6 devices on several devices. iOS5 draws everything correctly, and if I delete these four lines, everything draws correctly, but none of what I tried on iOS 6 stops .m34 from breaking the viewing order. This is not always as simple as the example I presented, but this is the most obvious case that I have seen.
Has anyone else experienced this, solved it?
Edit: Additional information for comment.
Yes, a typo with more than *.
Display the image, the QuadCurve menu, and the text image.
I called the method with .m34 in viewDidLoad, but changed it to viewDidAppear to quickly check you out.
Irrelevant. Don't get me wrong, subviews are listed in the correct order when you call
NSLog(@"%@", [self.view.subviews description]);
They simply do not draw on the screen correctly.
In desperation, I wrote some crazy weird code, and I found the following.
I can call a method that draws a menu with a delay of 10 seconds,
[self performSelector:@selector(createQuadCurveMenu) withObject:nil afterDelay:10];
which ends with
[self.view addSubview:menu]
As well as completely superfluous
[self.view bringSubviewToFront:menu]
and he still calls for ImageView, which is set as the lowest subview in .xib.
I checked two ways. I can go into .xib and set the image to hidden, and run again. I see the menu, now that the imageView does not cover it. I can also just comment on the code that applies the .m34 transform to the texture, and the menu displays correctly over the image again again. Again, nothing happens on iOS5 and iOS4.
At this point, I start to think that this is a bug inside iOS6 itself, and was waiting for the NDA to expire, so I can ask here if anyone else has experienced this.