gpt4 book ai didi

ios - iOS-Slide-Menu中的不同ViewController

转载 作者:行者123 更新时间:2023-12-01 18:48:04 27 4
gpt4 key购买 nike

我正在使用aryaxt/iOS-Slide-Menu。我的问题是:我需要根据所显示的View Controller显示不同的左侧菜单。这是我在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;

我尝试了很多东西,但没有任何效果。谢谢!

最佳答案

我只知道一种解决方案:

 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(我在不重新启动应用程序而更改语言时使用)

关于ios - iOS-Slide-Menu中的不同ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33357711/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com