問題描述
我無法使用情節提要實現以下目標:
I'm having trouble to achieve the following using a storyboard:
設置未完成時:運行應用程序 -> 顯示設置視圖控制器 -> 顯示主導航控制器設置完成后:運行應用程序 -> 顯示主導航控制器
When setup is not done: run app -> show settings view controller -> show main navigation controller When setup is done: run app -> show main navigation controller
所以基本上,我希望應用程序在某些情況下以編程方式從設置視圖開始,否則直接跳到主導航控制器.
So basically, I want the app to programmatically start with the settings view in certain cases, and otherwise skip right ahead to the main navigation controller.
我確實設法通過主導航控制器的模態樣式segue 顯示設置視圖,但我不知道如何在主導航控制器顯示之前顯示它.有什么想法嗎?
I did manage to show the settings view with a modal style segue from the main navigation controller, but I don't know how to display it before the main navigation controller is displayed. Any ideas?
推薦答案
我設法做到了一點不同:
I managed to do it a bit different:
- 使用
UINavigationController
作為初始視圖控制器. - 創建一個根視圖控制器來管理加載內容的決定.
- 創建從根視圖控制器到主視圖和設置視圖的 Storyboard Segue,并為這些 segue 提供適當的標識符.
- 使用根視圖控制器中的正確標識符調用
performSegueWithIdentifier
.
- Use a
UINavigationController
as the initial view controller. - Create a root view controller that will manage the decision of what to load.
- Create a Storyboard Segues from the root view controller to the main view and to settings view, and give the segues proper identifiers.
- Call the
performSegueWithIdentifier
with the proper identifier from your root view controller.
只是另一種解決方案,希望對您有所幫助.
Just another solution, hope this helps.
這篇關于iOS 5 故事板,以編程方式確定路徑的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!