5

我在我的项目中面临一个小问题。我有一个简单的 iPad 应用程序,它在横向方向使用 SplitView。MasterViewController 是 tableview 而 DetailView 是 WebView 如下所示:

在此处输入图像描述

上图结果如下:

在此处输入图像描述

在那之后,我把整个东西都放在了 ECSlidingViewController 里面。点击 MasterViewController 中的“菜单”按钮将显示侧边菜单,如下所示:

在此处输入图像描述

现在我可以点击菜单中的其他选项,假设我在菜单中点击了“联系人”,相关的视图控制器将如下所示:(此视图控制器没有任何详细视图)

在此处输入图像描述

到目前为止一切都很好,正是我想要的!!!!当我再次点击菜单按钮以显示菜单并再次选择“导航”以显示表格视图时,问题就开始了。当点击“导航”时,它会显示 MasterView 但隐藏 DetailView,如下所示:

在此处输入图像描述

除此之外,点击上面 tableivew 中的任何条目都会导致程序崩溃,并在控制台中显示以下消息:

* -[UIStoryboardReplaceSegue perform]、/SourceCache/UIKit_Sim/UIKit-2380.17/UIStoryboardBuiltInSegues.m:63 2013-03-30 13:59:58.179 19IPadIPad[5806:c07] 中的断言失败 *由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:'找不到''的拆分视图控制器祖先,同时执行拆分视图控制器将 segue(标识符'pushLink')替换为目标''' ***第一次抛出调用堆栈:(0x217b012 0x16bce7e 0x217ae78 0x1152665 0xa57349 0xa48b99 0xa48c14 0x6b0249 0x6b04ed 0x10ba5b3 0x213a376 0x2139e06 0x2121a82 0x2120f44 0x2120e1b 0x1d587e3 0x1d58668 0x600ffc 0x24bd dylib23e 调用)抛出异常c++5。

Can somebody look into the problem and tell where the problem could be. Thanks in advance.

UPDATE:

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.

UPDATE:

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];

}
4

1 回答 1

1

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.

由于 MainSplitViewController 类的 StoryBoard ID 设置为“SplitTop”,因此您可以将其添加到 MenuViewController 类的 ViewDidLoad 部分,其中定义了绘制菜单项的整个数组。

希望有帮助。

于 2013-03-31T09:42:44.057 回答