I am facing a little issue inside my project. I have a simple IPad app that is using SplitView in Lanscape orientation. MasterViewController is a tableview while DetailView is the WebView as shown below:
The above diagram results in the following:
After that, i have put the whole thing inside ECSlidingViewController. Tapping on the "Menu" button in MasterViewController will reveal the side menu as shown below:
Now i can tap on some other option in the menu, let us say i have tapped "Contact" inside the Menu, the associated view controller will come up as shown below: (This view controller does not have any detailview)
Everything till this point is fine and exactly what i wanted!!!! The problem starts now when i tap the Menu button again to reveal the menu and select the "Navigation" again to reveal the tableview. When the "Navigation" is tapped, it shows the MasterView but hides the DetailView as shown below:
Other than that, tapping on any entry in the tableivew above will cause the program to crash with the following message in console:
* Assertion failure in -[UIStoryboardReplaceSegue perform], /SourceCache/UIKit_Sim/UIKit-2380.17/UIStoryboardBuiltInSegues.m:63 2013-03-30 13:59:58.179 19IPadIPad[5806:c07] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not find a split view controller ancestor for '', while performing a split view controller replace segue (identifier 'pushLink') with destination ''' *** First throw call stack: (0x217b012 0x16bce7e 0x217ae78 0x1152665 0xa57349 0xa48b99 0xa48c14 0x6b0249 0x6b04ed 0x10ba5b3 0x213a376 0x2139e06 0x2121a82 0x2120f44 0x2120e1b 0x1d587e3 0x1d58668 0x600ffc 0x24bd 0x23e5) libc++abi.dylib: terminate called throwing an exception
Can somebody look into the problem and tell where the problem could be. Thanks in advance.
After talking to the user on chat who suggested that after i tap the navigation in menu, the next thing that appears is only the masterview and splitview is actually not loaded. Looks like that is the problem but i don't know how to fix that.
How ECSlidingView Is Integrated With The SplitView
I am updating the question after receiving a comment asking how the ECSlidingView is connected to the project and the SplitView.
I have created a class named 'MainSplitViewController' inherited from UISplitViewController, and connected it with the splitView in my storyboard in the identity inspector. Also i have given it the Storyboard ID of "SplitTop".
Then in my InitialViewController i have called the SplitView as the topviewcontroller as follow:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
self.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"SplitTop"];
}
The ECSlidingView menu appears when the "Menu" button is pressed on the MasterViewController as you can see in the images above. That menu button is using an IBAction to reveal the ECSlidingView:
- (IBAction)revealMenu:(id)sender {
[self.slidingViewController anchorTopViewTo:ECRight];
}
I have also used ECSlidingViewController in a test project i was working on. I guess i am able to understan the problem you are having.
First of all this problem does not have anything to do with SplitView or your navigation controller inside it as you can remove SplitView and it will work fine. This problem is associated completely how you are integrating SplitViewController inside the ECSlidingView library.
After going through the images you have posted above, it seems like ECSlidingViewController was added to the project before you started working on the SplitView. That means in your code, the navigation menu is still connected to your MasterViewController. It should be connected to the SplitViewController.
As your updated question suggests that you are calling your SplitView in the InitialView as follow:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
self.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"SplitTop"];
}
But the above code is just setting it to be the TopViewController. I have checked the ECSlidingView library and you will notice that the Menu table view that gets revealed is handled by the MenuViewController. That means you have to make necessary changes inside this class.
As your StoryBoard ID for MainSplitViewController class is set as 'SplitTop', you can add it in the ViewDidLoad section of the MenuViewController class where the whole array is defined that is drawing the Menu items.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With