Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Popover presenting underneath modal

Tags:

ios

ipad

I have a modal view controller that gets presented on iPad. Inside that modal I have a UIPopoverController that is presented to the user (triggered by a button press). What's crazy is that the popover is getting instantiated and rendered, but directly underneath the modal. I am presenting from a UIBarButtonItem, so there shouldn't be any view hierarchy issues on where it should be presented from. Doing a recursiveDescription on the window reveals that the view hierarchy is correct with the popover being on top, despite it visually being drawn underneath.

Any thoughts in what could be causing this? How do I fix it?

Update: I decided to try presenting a form sheet modal on the modal and experienced the same problem: the form sheet modal is rendered underneath the first modal. Truly puzzling...

like image 561
Wayne Hartman Avatar asked Dec 29 '25 11:12

Wayne Hartman


1 Answers

After a night's sleep I instantly discovered the problem:

destination.view.layer.zPosition = 1000;

Because I am doing some 3D affine transforms in the animation, I needed to raise the zPosition of the destination view's layer so that it doesn't clip the source view's layer when rotating. I was forgetting to change the zPosition back to 0 when it completes.

like image 57
Wayne Hartman Avatar answered Dec 31 '25 01:12

Wayne Hartman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!