3
votes

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...

1
How are you presenting the modal view controller?bbarnhart
Storyboard at first, but then went full manual code. Didn't make a difference.Wayne Hartman
Can you temporarily try calling the popover from a UIButton inside view controller instead of the bar button?bbarnhart
Create a small demo project, upload to a public site, then update the question. A small bounty would be nice but not required.David H

1 Answers

1
votes

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.