iOS-Slide-Menu 中的不同 ViewController
Different ViewControllers in iOS-Slide-Menu
我正在使用aryaxt/iOS-Slide-Menu。我的问题是:我需要根据显示的视图控制器显示不同的左侧菜单。这是我在 AppDelegate 中的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UserMenuViewController *leftMenu = (UserMenuViewController *) [self.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"UserMenuViewController"];
[SlideNavigationController sharedInstance].leftMenu = leftMenu;
当我尝试更改我的特殊 ViewController 中的左侧菜单时,左侧菜单出现黑屏。
AppDelegate *sharedeDelegate = ((AppDelegate *)[UIApplication sharedApplication].delegate);
ProfessionalMenuViewController *leftMenu = (ProfessionalMenuViewController *) [sharedeDelegate.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"ProfessionalMenuViewController"];
[SlideNavigationController sharedInstance].leftMenu = leftMenu;
我尝试了很多东西,但没有任何效果。谢谢!
我建议自定义leftMenuViewController,设置一个全局变量并根据全局变量的值在左侧菜单中显示不同的tableview内容,或者在leftMenuViewController中处理SlideNavigationControllerDidReveal通知并根据您当前打开的侧视图添加任何子视图或删除子视图控制器。
我只知道一个解决方案:
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
SlideNavigationController* landingScreen = (SlideNavigationController*)[mainStoryboard
instantiateViewControllerWithIdentifier: @"SlideNavigationController"];
LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"CVLeftMenuViewController"];
landingScreen.leftMenu = leftMenu;
landingScreen.enableShadow=YES;
landingScreen.enableSwipeGesture = YES;
landingScreen.panGestureSideOffset = 0;
delegate.window.rootViewController = landingScreen;
需要更新 SlideNavigationController 查看 landingScreen(我在不重启应用程序的情况下更改语言时使用)
我正在使用aryaxt/iOS-Slide-Menu。我的问题是:我需要根据显示的视图控制器显示不同的左侧菜单。这是我在 AppDelegate 中的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UserMenuViewController *leftMenu = (UserMenuViewController *) [self.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"UserMenuViewController"];
[SlideNavigationController sharedInstance].leftMenu = leftMenu;
当我尝试更改我的特殊 ViewController 中的左侧菜单时,左侧菜单出现黑屏。
AppDelegate *sharedeDelegate = ((AppDelegate *)[UIApplication sharedApplication].delegate);
ProfessionalMenuViewController *leftMenu = (ProfessionalMenuViewController *) [sharedeDelegate.window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"ProfessionalMenuViewController"];
[SlideNavigationController sharedInstance].leftMenu = leftMenu;
我尝试了很多东西,但没有任何效果。谢谢!
我建议自定义leftMenuViewController,设置一个全局变量并根据全局变量的值在左侧菜单中显示不同的tableview内容,或者在leftMenuViewController中处理SlideNavigationControllerDidReveal通知并根据您当前打开的侧视图添加任何子视图或删除子视图控制器。
我只知道一个解决方案:
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
SlideNavigationController* landingScreen = (SlideNavigationController*)[mainStoryboard
instantiateViewControllerWithIdentifier: @"SlideNavigationController"];
LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"CVLeftMenuViewController"];
landingScreen.leftMenu = leftMenu;
landingScreen.enableShadow=YES;
landingScreen.enableSwipeGesture = YES;
landingScreen.panGestureSideOffset = 0;
delegate.window.rootViewController = landingScreen;
需要更新 SlideNavigationController 查看 landingScreen(我在不重启应用程序的情况下更改语言时使用)