Note that there are some explanatory texts on larger screens.

plurals
  1. POCATransform 3D with a modified .m34 breaks view hierarchy/ordering in iOS6, but not the view it was applied to
    text
    copied!<p><strong>Foreword, this isn't me losing a view off screen because I did the transform wrong, it's weirder.</strong></p> <p>Problem is, if I use an .m34 transform to achieve the perspective I need, the view hierarchy breaks, but remove the transform and it draws everything correctly. </p> <p>Here's an example.</p> <p>I have a background image (subviewOne), a menu(subviewTwo), and an object on top of all of that which I apply the CATransform3D to (subviewThree).</p> <p>Simple code:</p> <pre><code>CALayer *layer = subviewThree.layer; CATransform3D perspectiveTransform = CATransform3DIdentity; perspectiveTransform.m34 = -1.0 / 500; layer.transform = perspectiveTransform; </code></pre> <p>Prior to applying this code, the view hierarchy was, and still is on iOS 5: </p> <pre><code>(bottom to top) subviewOne-&gt;subviewTwo-&gt;subviewThree </code></pre> <p>After applying it, I end up with:</p> <pre><code>(bottom to top still) subviewTwo-&gt;subviewOne-&gt;subviewThree </code></pre> <p>Now, subviewThree still has the perspective transform applied to it, and is in the correct spot, on top of everything else, same as on iOS5. However, the Menu/subviewTwo, is now hidden by the background image/subviewOne, and nothing I do will get it to be drawn on top of the subviewOne. No amount of insertSubviewAtIndex:, bringSubviewToFront, sendSubviewToBack, etc, will make the view draw correctly.</p> <p>This is incredibly peculiar particularly because the views that are drawn out of order are <strong><em>NOT</em></strong> having any kind of CATransform3D applied to them.</p> <p>I have verified this independently in two different apps and multiple devices 6 devices. iOS5 draws everything correctly, and if I remove those four lines, everything draws correctly, but nothing I've tried on iOS 6 stops the .m34 from breaking the view ordering. It's not always as simplistic as the example I've provided, but this is the most demonstrable case I have witnessed.</p> <p>Has anyone else experienced this, solved this?</p> <p><strong>Edit: More info for comment.</strong></p> <p>Yeah, typo with the extra *. </p> <p>Figure there's an Imageview, QuadCurve Menu, and Textview.</p> <p>I was calling the method with the .m34 in the viewDidLoad, but swapped it to the viewDidAppear real quick to check for you.</p> <p>Doesn't matter. Don't get me wrong, the subviews are listed in the correct order when you call</p> <pre><code>NSLog(@"%@", [self.view.subviews description]); </code></pre> <p>They just aren't drawn on screen correctly.</p> <p>In desperation, I wrote some crazy weird code, and I discovered the following.</p> <p>I can call the method that draws the menu on a 10 second delay,</p> <pre><code>[self performSelector:@selector(createQuadCurveMenu) withObject:nil afterDelay:10]; </code></pre> <p>which ends in </p> <pre><code>[self.view addSubview:menu] </code></pre> <p>As well as a totally superfluous</p> <pre><code>[self.view bringSubviewToFront:menu] </code></pre> <p>and it's still drawn behind an imageView that is set as the lowest subview in the .xib.</p> <p>I have verified this two ways. I can go into the .xib and set the imageView to hidden, and running again I can see the menu, now that the imageView isn't covering it. I can also just comment out the code that applies the .m34 transform to the textView, and the menu then again correctly appears on top of the imageView. Again, none of this happens on iOS5 and iOS4.</p> <p>At this point, I'm starting to think that it's a bug inside iOS6 itself, and have been waiting for the NDA to expire so I can ask here if anyone else has experienced it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload