問題描述
我無法使用情節(jié)提要實(shí)現(xiàn)以下目標(biāo):
I'm having trouble to achieve the following using a storyboard:
設(shè)置未完成時(shí):運(yùn)行應(yīng)用程序 -> 顯示設(shè)置視圖控制器 -> 顯示主導(dǎo)航控制器設(shè)置完成后:運(yùn)行應(yīng)用程序 -> 顯示主導(dǎo)航控制器
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
所以基本上,我希望應(yīng)用程序在某些情況下以編程方式從設(shè)置視圖開始,否則直接跳到主導(dǎo)航控制器.
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.
我確實(shí)設(shè)法通過主導(dǎo)航控制器的模態(tài)樣式segue 顯示設(shè)置視圖,但我不知道如何在主導(dǎo)航控制器顯示之前顯示它.有什么想法嗎?
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?
推薦答案
我設(shè)法做到了一點(diǎn)不同:
I managed to do it a bit different:
- 使用
UINavigationController
作為初始視圖控制器. - 創(chuàng)建一個(gè)根視圖控制器來管理加載內(nèi)容的決定.
- 創(chuàng)建從根視圖控制器到主視圖和設(shè)置視圖的 Storyboard Segue,并為這些 segue 提供適當(dāng)?shù)臉?biāo)識(shí)符.
- 使用根視圖控制器中的正確標(biāo)識(shí)符調(diào)用
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.
這篇關(guān)于iOS 5 故事板,以編程方式確定路徑的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!