0

我已经在一个项目中用故事板的方式实现了 JASidePanelController ,它工作正常。我有一个这样的故事板:

[NavigationController] -> [MySidePanelControllerViewController]   [LoginVC] -> [HomeVC] -> [ListVC] -> [DescriptionVC]

滑动菜单位于具有 Storyboard 的 ID的LoginVCcentrerViewController中。

现在我想只在ListVC中使用滑动菜单。我怎样才能做到这一点?

如果我将 Stroryboard ID 提供centrerViewController给 ListVC,则应用程序从 ListVC 开始,而不是在 loginVC。

4

1 回答 1

0

我做了同样的事情,但使用 MFSideMenuContainerViewController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
                                                        containerWithCenterViewController:_rootNavController
                                                        leftMenuViewController:settingDrawerController
                                                        rightMenuViewController:nil];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window makeKeyAndVisible];
    [self.window setRootViewController:container];
}

我已将我的控制器设置为应用程序委托,并将 loginViewContrller 作为模型视图从

- (void)applicationDidBecomeActive:(UIApplication *)application {

        [self showLoginView];
 }





- (void)showLoginView
{
    UIViewController *topViewController = [self.navController topViewController];
    if (![topViewController isKindOfClass:[LGLoginViewController class]]) {
        [self.navController popToRootViewControllerAnimated:YES];
        self.navController = nil;

        LGLoginViewController* loginView = [[LGLoginViewController alloc] initWithNibName:@"LGLoginViewController"bundle:nil];

        if (!self.navController) {
            self.navController = [[UINavigationController alloc] initWithRootViewController:loginView];
        } else {
            [self.navController initWithRootViewController:loginView];
        }

        self.navController.delegate = self;
        [self.window.rootViewController presentModalViewController:self.navController animated:NO];
    }
}
于 2013-12-27T11:01:37.083 回答