I posted a related question to no response but here I’ll be less narrow. Basically, I’m using a piece of open-source code to implement a facebook-style, slide to reveal type view. The implementation of this relies on a pattern in which the initial sliding view controller is the application window’s root view controller at launch. Then it permits every view controller to get a reference to that sliding view controller through this convenience method:
- (ECSlidingViewController *)slidingViewController
{
UIViewController *viewController = self.parentViewController;
while (!(viewController == nil || [viewController isKindOfClass:[ECSlidingViewController class]])) {
viewController = viewController.parentViewController;
}
return (ECSlidingViewController *)viewController;
}
I think this is where my problem lies. I want to have this slide-to-the-side style menu for a view controller that I present modally. But a modally presented view controller returns null for it’s parent view controller. So when I try to get a reference to that root view controller (the initial sliding view controller), I can’t. If I push the view controller, it works, but that’s not the flow that I want for the application. I thought that if I could add this modal view controller as a child of the presenting view controller, it would work. But when I tried that I got an exception that I was presenting modally a view controller that was already active. Can anyone suggest how to resolve this?
EDIT: Here’s an example of the kind of thing I’m trying to do.
I ended up using this tool to achieve the same effect and found implementation far, far simpler. http://cocoacontrols.com/controls/iiviewdeckcontroller