2016-12-06 28 views
0

我有一個應用程序UITabBarController,標籤導航照常,但其中一個標籤應根據項目目標導航到不同的視圖控制器,一切都與故事板佈局。導航取決於Xcode目標

加載其中一個視圖控制器時,似乎無法找到一種方法,而且看起來很醜,也不可能。

歡迎任何建議。

+1

什麼關於[this](http://www.appcoda.com/using-xcode-targets/)? – Ryan

+0

@Ryan很好,但找不到任何與觸摸標籤欄項導航的事實有關的事情,並根據目標導航到不同的地方。 –

回答

0

如果你有單獨的Plist爲每個目標,你可以再補充您通過主束信息詞典

plist中讀取自定義變量:

<key>NavigationType</key> 
<string>Type1</string> 

迅速:

guard let navigationType = Bundle.main.infoDictionary?["NavigationType"] as? String else { 
    fatalError("Could not find navigation type in the plist") 
} 
switch navigationType { 
case "Type1": 
    // do something 
case "Type2": 
    // do another thing 
    ....