Ios Swift中实现SWRevealViewController的问题

Ios Swift中实现SWRevealViewController的问题,ios,swrevealviewcontroller,Ios,Swrevealviewcontroller,您好,我是iOS新手,正在尝试实现SWRevealViewController。我已经学习了一些教程,并在教程项目中成功地实现了SWRevealViewController,但我正在努力在现有项目中实现幻灯片菜单 因此,我有一个故事板,其中首先是一个NavigationController,它是一个初始视图控制器,然后是登录、进入或注册屏幕。所有已连接到navigationcontroller。登录后,我将显示homes屏幕,其中显示汉堡菜单 通过查看教程,我尝试将ViewController拖

您好,我是iOS新手,正在尝试实现
SWRevealViewController
。我已经学习了一些教程,并在教程项目中成功地实现了
SWRevealViewController
,但我正在努力在现有项目中实现幻灯片菜单

因此,我有一个故事板,其中首先是一个
NavigationController
,它是一个初始视图控制器,然后是登录、进入或注册屏幕。所有已连接到navigationcontroller。登录后,我将显示homes屏幕,其中显示汉堡菜单

通过查看教程,我尝试将ViewController拖到情节提要中,并添加一个类
SWRevealViewController
。然后我拖动了
TableViewController
,并用菜单项填充了一些行。接下来,我完成了从SWRevealViewController到Table view controller的控制拖动,并选择了
reveal view controller set controller
,将其命名为
sw\u rear

现在在
sw_front
的教程中,他们将
SWRevealViewController
连接到直接连接到主屏幕的NavigationViewController。但在我的项目中,它并不是因为NavigationController直接连接到signin。我在这里试过两件事。首先,我通过segue从
SWRevealViewController
连接到NavigationViewController,但它不起作用,我还尝试将另一个NavigationViewController嵌入主屏幕,但它仍然不起作用。我希望你能理解我的问题

代码:


教程链接

实际上,SWRevealViewController在标识符不起作用的情况下运行,因此进入您的SWRevealViewController类并用此方法替换一个方法

- (void)loadStoryboardControllers
{
    if ( self.storyboard && _rearViewController == nil )
    {
    //Try each segue separately so it doesn't break prematurely if either Rear or Right views are not used.
    @try
    {
        UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"yourMenuController storyboard Identifier"];
        SWRevealViewControllerSegueSetController *segue = [[SWRevealViewControllerSegueSetController alloc] initWithIdentifier:SWSegueRearIdentifier source:self destination:controller];
        [segue perform];
    }
    @catch(NSException *exception) {}

    @try
    {
        UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"your front viewcontroller storyboard Identifier"];
        SWRevealViewControllerSegueSetController *segue = [[SWRevealViewControllerSegueSetController alloc] initWithIdentifier:SWSegueFrontIdentifier source:self destination:controller];
        [segue perform];
    }
    @catch(NSException *exception) {}

    @try
    {
        [self performSegueWithIdentifier:SWSegueRightIdentifier sender:nil];
    }
    @catch(NSException *exception) {}
}

}

这是一个示例SWRevealViewController幻灯片菜单


您是否收到此错误[UIStoryboardSegueTemplate segueWithDestinationViewController:]
- (void)loadStoryboardControllers
{
    if ( self.storyboard && _rearViewController == nil )
    {
    //Try each segue separately so it doesn't break prematurely if either Rear or Right views are not used.
    @try
    {
        UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"yourMenuController storyboard Identifier"];
        SWRevealViewControllerSegueSetController *segue = [[SWRevealViewControllerSegueSetController alloc] initWithIdentifier:SWSegueRearIdentifier source:self destination:controller];
        [segue perform];
    }
    @catch(NSException *exception) {}

    @try
    {
        UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"your front viewcontroller storyboard Identifier"];
        SWRevealViewControllerSegueSetController *segue = [[SWRevealViewControllerSegueSetController alloc] initWithIdentifier:SWSegueFrontIdentifier source:self destination:controller];
        [segue perform];
    }
    @catch(NSException *exception) {}

    @try
    {
        [self performSegueWithIdentifier:SWSegueRightIdentifier sender:nil];
    }
    @catch(NSException *exception) {}
}