Objective c 在加载视图之前设置新的window.rootViewController

Objective c 在加载视图之前设置新的window.rootViewController,objective-c,ios5,uiviewcontroller,uinavigationcontroller,ios6,Objective C,Ios5,Uiviewcontroller,Uinavigationcontroller,Ios6,因此,我正在尝试在我的应用程序中安装此导航框架: 现在,如果你看附加的图像,我有我的登录屏幕。登录完成后,我会将一个Segue模式推送到我的“主页”,在那里,我想在到达主页后开始使用FRLayeredNavigationController。在使用故事板时,这可能吗?根据Youtube视频,人们通常会通过以下方式使用FRLayeredNavigationController: - (BOOL)application:(UIApplication *)application didFi

因此,我正在尝试在我的应用程序中安装此导航框架:

现在,如果你看附加的图像,我有我的登录屏幕。登录完成后,我会将一个Segue模式推送到我的“主页”,在那里,我想在到达主页后开始使用FRLayeredNavigationController。在使用故事板时,这可能吗?根据Youtube视频,人们通常会通过以下方式使用FRLayeredNavigationController:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.

        HomeViewController* homeController = [[HomeViewController alloc] init];
        FRLayeredNavigationController* lnc = [[FRLayeredNavigationController alloc] initWithRootViewController:homeController];

        self.window.rootViewController = lnc;
    }



   [self.layeredNavigationController pushViewController:vc inFrontof:self maximumWidth:NO animated:YES];

我还没有找到一种使用Segue的。。。但我实现这一目标的方式如下:

如果登录成功,并且您希望进入应用程序的下一部分,则以下是您将如何过渡:

- (void)loginSucceeded
{
    UIViewController * vc = (UIViewController*)[self.storyboard instantiateViewControllerWithIdentifier:@"someIdentifier"];
    FRLayeredNavigationController * nav = [[FRLayeredNavigationController alloc] initWithRootViewController:vc configuration:^(FRLayeredNavigationItem *item) {
        item.width = 300;
        item.nextItemDistance = 90;
    }];
    [self presentViewController:nav animated:YES completion:nil];
}
您需要将情节提要ID设置为上述方法中指定的ID。在查看情节提要并选择您设计的ViewController时,可以在“标识检查器”选项卡中找到此选项

此外,您将不再需要执行先前创建的序列,因此请删除该序列

任何未来要“推”到屏幕上的视图控制器,只需调用以下命令:

UIViewController * vc = (UIViewController*)[self.storyboard instantiateViewControllerWithIdentifier:@"SomeStoryboardIDHere"];
[self.layeredNavigationController pushViewController:vc inFrontOf:self maximumWidth:YES animated:NO];