2017-04-15 34 views
0

我在我的應用程序中有兩個配置文件。因此,在一些初始配置文件設置後,我的應用將以不同的屏幕開始(firstVCSecondVC)。 enter image description hereintially select sw_front view controller swrevealviewcontroller

所以基於初始(考慮的appdelegate:didfinish方法)設置,我想選擇 「sw_front」 是firstVC或secondVC。

每次首先VC是首先加載。如果我想先打開SecondVC,我想是非常simlpe代碼viewWillAppear中方法,可能是不正確的:

UIViewController * sec = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondID"]; 

UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:sec]; 

[self.revealViewController pushFrontViewController:nav animated:YES]; 

的問題是應用程序直接進入firstVC,但我想它直接在FirstVC或SecondVC進入, 需要的時候。 謝謝,任何幫助讚賞:)

回答

0

可能是你編碼錯了。當你推動下面的代碼,請嘗試下面的代碼。

UIStoryboard *storyboard = nil; 
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
SWRevealViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SecondID"]; 
[self.navigationController pushViewController:vc animated:YES]; 
+0

感謝@hari的回答,但是我上面寫的代碼也工作得很好..問題是,它首先進入第一個VC n,然後進入第二個VC。我想在需要時直接輸入SecondVC。 –

+0

@ nikdange_me-在這種情況下,你可以爲兩個類別單獨的導航控制器,那麼它將工作,我假設如果流**如果Fitst視圖** - > **第二視圖**,在這種情況下第二視圖不要有導航,它會基於第一控制,如果我錯了讓我知道 –

+0

你肯定導航控制器會幫助? –

相關問題