Ios 侧面导航单击不工作

Ios 侧面导航单击不工作,ios,github,storyboard,uitabbarcontroller,Ios,Github,Storyboard,Uitabbarcontroller,我从库中实现了这个幻灯片菜单,并使用了uitabbarcontroller Home viewcontroller正在使用此幻灯片菜单,但单击侧导航栏时会显示幻灯片栏菜单,但单击记录时不会发生任何操作。然而,如果我在没有tabbarcontroller的情况下使用this slidemenu,它就会工作 任何人如果在IOS中使用objective C在uitabbarcontroller下使用故事板实现此幻灯片菜单。请分享您的答案。在您的代码中,我做了一些更改,如self.window.root

我从库中实现了这个幻灯片菜单,并使用了uitabbarcontroller

Home viewcontroller正在使用此幻灯片菜单,但单击侧导航栏时会显示幻灯片栏菜单,但单击记录时不会发生任何操作。然而,如果我在没有tabbarcontroller的情况下使用this slidemenu,它就会工作


任何人如果在IOS中使用objective C在uitabbarcontroller下使用故事板实现此幻灯片菜单。请分享您的答案。

在您的代码中,我做了一些更改,如
self.window.rootViewController
App Delegate

-(void)setupDrawers{
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
                                                             bundle: nil];
    self.landingScreen = (SlideNavigationController*)[mainStoryboard
                                                      instantiateViewControllerWithIdentifier: @"launchingNVCtr"];

    LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard
                                                                 instantiateViewControllerWithIdentifier: @"LeftMenuViewController"];

    RightMenuViewController *rightMenu = (RightMenuViewController*)[mainStoryboard
                                                                    instantiateViewControllerWithIdentifier: @"RightMenuViewController"];

    self.landingScreen = [SlideNavigationController sharedInstance];
    self.landingScreen.rightMenu = rightMenu;
    self.landingScreen.leftMenu = leftMenu;
    self.landingScreen.menuRevealAnimationDuration = 0.18f;
    // Creating a custom bar button for right menu
    UIButton *button  = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    [button setImage:[UIImage imageNamed:@"gear"] forState:UIControlStateNormal];
    [button addTarget:[SlideNavigationController sharedInstance] action:@selector(toggleRightMenu) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.landingScreen.rightBarButtonItem = rightBarButtonItem;

    [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidClose object:nil queue:nil usingBlock:^(NSNotification *note) {
        NSString *menu = note.userInfo[@"menu"];
        NSLog(@"Closed %@", menu);
    }];

    [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidOpen object:nil queue:nil usingBlock:^(NSNotification *note) {
        NSString *menu = note.userInfo[@"menu"];
        NSLog(@"Opened %@", menu);
    }];

    [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidReveal object:nil queue:nil usingBlock:^(NSNotification *note) {
        NSString *menu = note.userInfo[@"menu"];
        NSLog(@"Revealed %@", menu);
    }];
}
此外,我还更改为
SlideNavigationController
定义新的
UINavigationController
,然后提供
情节提要Id
,以访问下面的代码

 UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
                                                             bundle: nil];
 self.landingScreen = (SlideNavigationController*)[mainStoryboard
                                                      instantiateViewControllerWithIdentifier: @"launchingNVCtr"];
还有一些代码更改为
appDelegate

-(void)setupDrawers{
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
                                                             bundle: nil];
    self.landingScreen = (SlideNavigationController*)[mainStoryboard
                                                      instantiateViewControllerWithIdentifier: @"launchingNVCtr"];

    LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard
                                                                 instantiateViewControllerWithIdentifier: @"LeftMenuViewController"];

    RightMenuViewController *rightMenu = (RightMenuViewController*)[mainStoryboard
                                                                    instantiateViewControllerWithIdentifier: @"RightMenuViewController"];

    self.landingScreen = [SlideNavigationController sharedInstance];
    self.landingScreen.rightMenu = rightMenu;
    self.landingScreen.leftMenu = leftMenu;
    self.landingScreen.menuRevealAnimationDuration = 0.18f;
    // Creating a custom bar button for right menu
    UIButton *button  = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    [button setImage:[UIImage imageNamed:@"gear"] forState:UIControlStateNormal];
    [button addTarget:[SlideNavigationController sharedInstance] action:@selector(toggleRightMenu) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.landingScreen.rightBarButtonItem = rightBarButtonItem;

    [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidClose object:nil queue:nil usingBlock:^(NSNotification *note) {
        NSString *menu = note.userInfo[@"menu"];
        NSLog(@"Closed %@", menu);
    }];

    [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidOpen object:nil queue:nil usingBlock:^(NSNotification *note) {
        NSString *menu = note.userInfo[@"menu"];
        NSLog(@"Opened %@", menu);
    }];

    [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidReveal object:nil queue:nil usingBlock:^(NSNotification *note) {
        NSString *menu = note.userInfo[@"menu"];
        NSLog(@"Revealed %@", menu);
    }];
}
然后点击
登录
按钮时调用以下方法

-(void)displayLandingScreen{
    [self setupDrawers];
    self.window.rootViewController = self.landingScreen;
}
用户点击
注销时的以下代码

-(void)logOutPressed{
    //mainTabBar
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
                                                             bundle: nil];
    UITabBarController *loginTab = (UITabBarController*)[mainStoryboard
                                                      instantiateViewControllerWithIdentifier: @"mainTabBar"];

    self.window.rootViewController = loginTab;
}

您可以在登录后分享您的代码吗?好的,您想要
uitabar
吗?是的,但登录后不要。我需要使用tabbar第一部分的主页,在那里这些侧导航栏应该工作。没有仍然有一些问题。我不需要那些登录视图控制器,需要在第一个tabbar部分的直接主页,我在这个新版本中做到了这一点。现在,侧导航单击不适用于该问题@这是你的项目流程,但是我按照你的要求创建了。但是我做了必要的更改,没有工作。您是否可以提出任何替代方案。在这种情况下,您可以看到,当单击侧栏时,仅行导航关闭,并且视图控制器未重新加载。您是否浏览了IOSslide菜单应用程序左视图控制器中的didselect行委托,单击该行时,未加载新控制器。