我已经在项目中使用storyboards way实现了JASidePanelController,它运行正常。 我有一个这样的故事板:
[NavigationController] -> [MySidePanelControllerViewController] [LoginVC] -> [HomeVC] -> [ListVC] -> [DescriptionVC]
滑动菜单位于 LoginVC ,其中包含Storyboard的ID centrerViewController
。
现在我想只在 ListVC 中使用滑动菜单。我怎么能这样做?
如果我将Stroryboard ID centrerViewController
提供给ListVC,则应用程序从ListVC开始,而不是在loginVC开始。
答案 0 :(得分: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];
}
}