1
votes

Here is a visual representation of the UISplitViewController:

I'm trying to present a UIViewController (myVC) that's a subview of a UIView inside the DetailViewController of a UISplitViewController using this:

[appDelegate.splitViewController presentViewController:myVC animated:NO completion:nil];

It presents, I dismiss it, the app rotates without a hitch, then when I try to reload the detail view by clicking on a cell in the rootViewController (a UINavigationController), all the [orangeUIView removeFromSuperview] messages are mysteriously disabled (there are more orange UIViews hidden here that are inside a mainScrollView). The "INFO LABEL" in the topToolbar is updating, so I know the cell is sending data...

Why would this activity disable removeFromSuperview if presented using splitViewController? I've presented myVC using the detailViewController...

[appDelegate.detailViewController presentViewController:myVC animated:NO completion:nil];

which doesn't disable removeFromSuperview, but causes an assortment of other rotational crashes.

What's going on here?

1
"I'm presenting a UIViewController that's a subview of a smaller UIView inside the DetailViewController" -- this doesn't make sense. When a view controller is presented modally, it takes the whole screen, it can't be a subview (it's not a view, it's a view controller) of a smaller view inside a controller. You'll need to give more detail about your structure for us to help.rdelmar
I've added myVC.view (Core Plot hostingView) to a UIView by addSubview that's 500x300 in the detail part of a split view...I want to present the myVC (UIViewController) instance fullscreen (since you can't present a UIView modally), which it does, then readd the myVC.view back into it's container, which it does. The structure my be affected by how splitViewController handles modals, for instance, the settings for MainWindow_iPad.xib are set to present with "Current Context" with a transition style of "Flip Horizontal." Could this be part of the problem?whyoz
Good grief, I read that twice and still have no idea what it says. It would really help if you'd more clearly distinguish between ViewControllers and UIViews. You're using the very-different-thing terms kind of interchangeably: "...since you can't present a UIView modally" : well, no, you can't present a UIView at all. You can present a ViewController, and that you can present modally. Maybe you mean you want to add a UIView to your ViewController's root view and have fill the entire root view? Just not clear what you're doing or asking...Bill Patterson
Yes, I think that would be an abuse. First, it would be good to use the correct terms -- if you're talking about view hierarchies, the terms are subview and superview not child and parent, which are the terms to use for view controllers when one is embedded in another. As I said above, if you want to add a view controller's view as a subview of another controller's view, then that controller needs to be added as a child view controller. If you then want to present it modally, you would have to remove it from its parent, and then present it, and reverse that process when you want it back.rdelmar
BTW, that blog you linked to is out of date, because Apple has now provided us with a way to do custom container controllers. You can read about them in the doc, "Implementing a Custom Container View Controller". This is what I'm talking about when I say to add something as a child view controller.rdelmar

1 Answers

0
votes

Since this question was created as a result of a previous question, the answer to this problem was...try something else. I was unable to fix this problem by presenting a view controller, most likely because I'm using a custom UISplitViewController with a hierarchy I'd rather not get into.

Here is the solution I came up with:

Core Plot - Options on making the graph full screen - addSubview after presenting modal problems