0

我正在尝试实现 AMSlideMenu。我的应用程序流程如下 MainVC -> SlideMenuVC -> LoginVC

现在在 LoginVC 中,如果按下用户登录按钮,我想启动一个新的 VC,它应该自动在其中包含 AMSlideMenu。我该怎么做 ?

在此处输入图像描述

紫色背景的 VC 是 LoginVC

4

2 回答 2

0

直接来自github上的文档

You can use AMSlideMenu with both static cells and dynamic cell prototypes.

Just follow this steps:
1. Copy AMSlideMenu/AMSlideMenuForStoryboard folder to your project. 
2. Make a subclass of AMSlideMenuMainViewController. Assume you made MainVC.h and MainVC.m files (like in this project).
3. Add a UIViewController to your iPhone's or iPad's storyboard and name it's class to MainVC and embed it in UINavigationController
4. For Left Menu:
       Add a UITableViewController to your storyboard and name it's class to any class that inherits from 
       AMSlideMenuLeftTableViewController. Connect the AMSlideMenuMainViewController with your subclass with a custom        segue of type AMSlideMenuLeftMenuSegue, set the segue identifier to leftMenu.

    For Right Menu:
       Add a UITableViewController to your storyboard and name it's class to any class that inherits from 
       AMSlideMenuRightTableViewController. Connect the AMSlideMenuMainViewController with your subclass with a custom        segue of type AMSlideMenuRightMenuSegue, set the segue identifier to rightMenu.

5. To add Content ViewController you have to to do the following:
       • Create your content view controller and embed it in a UINavigationController
       • Connect it to the AMSlideMenuLeftTableViewController or AMSlideMenuRightTableViewController with custom segue          AMSlideMenuContentSegue and set some identifier.
      If you want to use dynamic cells , then you have to perform segues in -tableView:didSelectRowAtIndexPath: method yourself.

6.. In MainVC.m override these methods and return segue identifiers that you setted in previous step: 

-(NSString *)segueIdentifierForIndexPathInLeftMenu:(NSIndexPath *)indexPath;
-(NSString *)segueIdentifierForIndexPathInRightMenu:(NSIndexPath *)indexPath;
If you want to use multiple storyboards, or just want to use storyboard ids instead of segues, then override these methods:

-(UINavigationController *)navigationControllerForIndexPathInLeftMenu:(NSIndexPath *)indexPath;
-(UINavigationController *)navigationControllerForIndexPathInRightMenu:(NSIndexPath *)indexPath;
Thats it, you are done.

我会检查示例项目以了解如何实现您想要的。

于 2014-07-22T15:19:18.467 回答
0

我通过显式加载这样的segue解决了这个问题

[self.mainSlideMenu.leftMenu performSegueWithIdentifier:@"tipsSegue" sender:sender];
于 2014-07-22T16:49:10.897 回答