我正在尝试实施AMSlideMenu。我的应用程序像MainVC一样流动 - > SlideMenuVC - > LoginVC
现在在LoginVC中如果按下用户登录按钮我想启动一个新的VC,它应该自动拥有AMSlideMenu。我该怎么办?
具有紫色背景的VC是LoginVC
答案 0 :(得分: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.
我会检查示例项目,以了解如何处理您想要的内容。
答案 1 :(得分:0)
我通过显式加载像这样的
来解决问题[self.mainSlideMenu.leftMenu performSegueWithIdentifier:@"tipsSegue" sender:sender];