问题描述
我正在做一个项目(更新)我必须在其中添加一个侧边栏。现在该项目现在没有使用导航控制器。我可以在不使用NavigationController的情况下使用SWRevealViewController。请帮帮我。任何示例代码都很有帮助。
I am currently doing a project (an update) I have to add a sidebar in it. the project is now currently done without using navigation controller. Can I use SWRevealViewController in it without using NavigationController. Please help me. Any sample codes are helpful.
在示例代码中,我看到导航是使用项目没有的navigationController完成的。
In the sample codes i saw the navigation is done using navigationController which the project doesn't have.
谢谢
更新:
转换代码。如何使用故事板ID管理它。
Transition code. How can I manage this using storyboard ID.
if ( [segue isKindOfClass: [SWRevealViewControllerSegue class]] ) {
SWRevealViewControllerSegue *swSegue = (SWRevealViewControllerSegue*) segue;
swSegue.performBlock = ^(SWRevealViewControllerSegue* rvc_segue, UIViewController* svc, UIViewController* dvc) {
UINavigationController* navController = (UINavigationController*)self.revealViewController.frontViewController;
[navController setViewControllers: @[dvc] animated: NO ];
[self.revealViewController setFrontViewPosition: FrontViewPositionLeft animated: YES];
};
推荐答案
您需要推送或建模新视图控制器调用以下代码
where you need to push or model new view controller call the below code
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"yourstoryboardname" bundle: nil];
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"yourIDName"];
[[self navigationController] pushViewController:viewController animated:NO];
这篇关于不使用navigationController的SWrevealViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!