SWrevealViewController 不使用 navigationController [英] SWrevealViewController without using navigationController

查看:22
本文介绍了SWrevealViewController 不使用 navigationController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在做一个项目(更新),我必须在其中添加一个侧边栏.该项目目前是在不使用导航控制器的情况下完成的.我可以在其中使用 SWRevealViewController 而不使用 NavigationController.请帮我.任何示例代码都有帮助.

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];

这篇关于SWrevealViewController 不使用 navigationController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆