【问题标题】:I have implemented IOS Slide Menu Navigation View Controller我已经实现了 IOS Slide Menu Navigation View Controller
【发布时间】:2016-04-06 05:29:33
【问题描述】:

我已经在我的应用程序中实现了 iOS 滑动菜单导航控制器,并且之前它工作正常。但不知何故,现在它的左菜单视图控制器正在黑屏。请建议是否有人遇到此问题。下面的代码我在 Appdelegate.m didFinishLaunchingWithOptions 中提到过。

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
                                                         bundle: nil];
self.navigationController = (UINavigationController*)[mainStoryboard
 instantiateViewControllerWithIdentifier: @"navBar"];

self.landingScreen = (SlideNavigationController*)[mainStoryboard
                                                  instantiateViewControllerWithIdentifier: @"FirstViewController"];

self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];


LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard
                                                             instantiateViewControllerWithIdentifier: @"LeftMenuViewController"];
self.landingScreen = [SlideNavigationController sharedInstance];
self.landingScreen.leftMenu = leftMenu;
// Creating a custom bar button for right menu

[[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);
}];

【问题讨论】:

  • 你给故事板ID提供了标识符吗?
  • 确保你的 self.navigationController 不是 nil。
  • 是的,我已经提到过。这比昨天晚上更早工作正常。我昨天刚刚用 //**NSLog 替换了 NSLog 并将构建发送到客户端,它的显示就像图像一样。今天我再次将 //**NSLog 与 NSLog 互换。但它仍然显示上述内容。
  • 没有。我已经提到过 self.navigationController = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier: @"navBar"];并且这个导航控制器与视图控制器相连
  • 当我在情节提要中提到了左菜单视图控制器的错误标识符时。在给出正确的标识符后,它在编译时显示错误,其构建成功,如上图。

标签: ios objective-c uinavigationcontroller navigation-drawer


【解决方案1】:

之前用 //**NSLog 替换 NSLog 的一个错误是在 SlideNavigationController.m 中替换 NSlog 的问题

//之前 如果(单例) //**NSLog(@"Singleton 实例已经存在。您只能实例化一个 SlideNavigationController 实例。这可能会导致重大问题");

//从 NSLOG 中删除 //** 现在它工作正常 如果(单例) NSLog(@"Singleton 实例已存在。您只能实例化一个 SlideNavigationController 实例。这可能会导致重大问题");

感谢 Bond 和 Keyur 提供反馈。

【讨论】:

    猜你喜欢
    • 2017-10-23
    • 1970-01-01
    • 2011-11-29
    • 1970-01-01
    • 1970-01-01
    • 2011-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多