1

I have a requirement to present a modal ViewController over a UISplitViewController (i.e. obscuring both the master and detail views, when in landscape).

My code is based on Apple's sample code for Multiple Detail Views, and I've added the presentModalViewcontroller to didFinishLaunching.

To present the modal view, I've used this,

[self.window.rootViewController presentModalViewController:entryView animated:NO];

and this,

[[self.splitViewController.viewControllers objectAtIndex:0] presentModalViewController:entryView animated:NO];

...and both behave in the same way (explained below).

The modal view is presented as I intend, i.e. the view pops up and covers the UISplitView as required. All good so far.

However, as a consequence of presenting the modal view, iOS calls willHideViewController for the obscured UISplitViewController master view. I guess that's reasonable, as the master view is being hidden.

The real problem occurs when the modal view is dismissed, because willShowViewController is NOT called to undo the changes made in willHideViewController (i.e. remove the popover button added to the detail view when the master view was hidden).

This unwanted popover button then sits there, on my Detail view navbar, generally causing a nuisance.

Any thoughts on how to get willShowViewController to be called when the modal view is dismissed, or to otherwise fix this issue would be appreciated.

4

0 回答 0