1

所以我想在我的應用程序安裝此導航框架之前,設置一個新的window.rootViewController:現在視圖被加載

https://github.com/weissi/FRLayeredNavigationController

http://www.youtube.com/watch?v=k9bFAYtoenw&feature=plcp

,如果你看一下添附圖像,我有我的登錄屏幕。登錄完成後,我會將Segue Modal推入我的「主頁」頁面,然後在那裏,我希望一旦到達我的主頁就開始擁有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]; 

enter image description here

回答

2

我還沒有發現那位辦法做到這一點使用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]; 
} 

您需要將Storyboard ID設置爲上述方法中指定的值。這可以在查看故事板並選擇您設計的ViewController時在「Identity Inspector」選項卡中找到。

此外,您不再需要執行先前創建的segue,因此請刪除它。

今後的任何視圖控制器要「推」到屏幕上,你只需要調用以下:

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