2015-06-22 54 views
3

我已經使用SWRevealViewController設置我的應用程序,它工作正常,但我想改變它的工作原理。目前,我有在同一水平以下觀點:SWRevealViewController - 從側面菜單推視圖控制器

  • 首頁
  • 視圖B

但我想:

  • 首頁
    • 查看A
    • 視圖B

我還是想家庭,視圖A,視圖B是在菜單中,但上觀看或視圖B,當點擊它就會推到首頁。並且在導航欄中它有一個後退按鈕,而不是菜單按鈕。

這可能使用SWRevealViewController嗎?

回答

6

客觀-C

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil]; 
SWRevealViewController *main = (SWRevealViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"SWRevealViewController"]; 
[self presentViewController:main animated:YES completion:nil]; 

迅速 - 它會自動打開SWL

的根視圖控制器
let storyboard = UIStoryboard(name: "Main", bundle: nil) 
let main = storyboard.instantiateViewControllerWithIdentifier("SWRevealViewController") as! UIViewController //SWRevealViewController 
self.presentViewController(main, animated: true, completion: nil) 
+0

@AvijitNagare - 我不明白.. –

0

我發現了一個answer,希望它可以幫助別人閱讀這個。它有兩種方式,SideMenu,當你有一個tabBarController或只有一個NavigationController。從答案發帖子,爲我工作。

用的TabBar控制器:

UITabBarController *tbc = (UITabBarController *)self.revealViewController.frontViewController; 
    UINavigationController *nc = tbc.selectedViewController; 
    [nc pushViewController:myVC animated:NO]; 
    [self.revealViewController setFrontViewPosition:FrontViewPositionLeft animated:YES]; 

導航控制器:

UINavigationController *frontVC = (UINavigationController *)self.revealViewController.frontViewController; 
[frontVC pushViewController: yourVC animated:NO]; 
[self.revealViewController pushFrontViewController:frontVC animated:YES]; 
相關問題