我已经实现了IOS幻灯片菜单导航视图控制器

时间:2016-04-06 05:29:33

标签: ios objective-c uinavigationcontroller navigation-drawer

我已经在我的应用程序中实现了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);
}];

enter image description here

1 个答案:

答案 0 :(得分:0)

早先用// ** NSLog替换NSLog的一个错误就是将问题替换为SlideNavigationController.m中的NSlog

//早些时候     if(singletonInstance)         // ** NSLog(@“Singleton实例已经存在。您只能实例化一个SlideNavigationController实例。这可能会导致重大问题”);

//从NSLOG中删除此// **之后,它的工作正常     if(singletonInstance)          NSLog(@“Singleton实例已经存在。您只能实例化一个SlideNavigationController实例。这可能会导致重大问题”);

感谢Bond和Keyur提供反馈意见。