2015-07-11 36 views
1

我面臨在nib文件中添加滑動導航的問題。 請幫我如何在ios文件中的ios中添加滑動導航

我有一個例子,但其故事板,我想它在筆尖使用這樣我就可以打開一個菜單形式左側

[SlideNavigationController sharedInstance].rightMenu = rightMenu; 
[SlideNavigationController sharedInstance].menuRevealAnimationDuration = .18; 


// Creating a custom bar button for right menu 
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 30)]; 
[button setImage:[UIImage imageNamed:@"gear"] forState:UIControlStateNormal]; 
[button addTarget:[SlideNavigationController sharedInstance] action:@selector(toggleRightMenu) forControlEvents:UIControlEventTouchUpInside]; 
UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; 
[SlideNavigationController sharedInstance].rightBarButtonItem = rightBarButtonItem; 

    SlideNavigationController *nav = [[SlideNavigationController alloc] initWithRootViewController:viewCon]; 
    nav.navigationBarHidden=YES; 
    self.window.rootViewController=nav; 
    [self.window makeKeyAndVisible]; 

回答

0

創建LeftMenuViewController XIB實施和頭文件。最後,你應該有這些領域:

LeftMenuViewController.h 
LeftMenuViewController.m 
LeftMenuViewController..xib 

並更換線

LeftMenuViewController *leftMenu = (LeftMenuViewController*)[mainStoryboard 
               instantiateViewControllerWithIdentifier: @"LeftMenuViewController"]; 

本 - 從廈門國際銀行

LeftMenuViewController *sm = [[A1SideMenuViewController alloc]initWithNibName:@"LeftMenuViewController" bundle:nil]; 
+0

請檢查我的更新代碼 –

+0

如果你完全改變你的問題,你應該創建一個新的問題。我的回答是關於你對故事板的問題 – seeya