我剛剛在Swift中創建了一個標籤UIViewController
,全新的,沒有代碼。 我想知道如何改變應用程序啓動的標籤。例如,它具有視圖1和視圖2.底部具有兩個選項卡,選項卡1和選項卡2.我怎樣才能將選項卡和頁面啓動到的位置是選項卡2,視圖2.而不是始終打開並從第一個標籤開始。感謝您的幫助!Starting Tab - UITabBarController Swift iOS
1
A
回答
1
我認爲它的自然UITabViewController
顯示第一個UIViewController
。
編輯:
最好的解決辦法是繼承UITabBarController
和更改所選指標在它的viedDidLoad()代表:
0
這裏是一個可能的解決方案。在你的viewWillAppear方法中。
倍率FUNC viewWillAppear中(){
let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("Enter your tabBar storyboard ID here") as! UITabBarController
vc.selectedIndex = 0
self.presentViewController(vc, animated: true, completion: nil)
}
- 的的selectedIndex 0是第一個的TabBar。您可以將其更改爲任何你想要的TabBar在main.storyboard身份ID打開
- 設置一個故事板ID
相關問題
- 1. iOS Tab Bar問題(Swift)
- 2. UITabbarController default tab突出顯示
- 3. iOS UITabBarController問題
- 4. Swift UITabBarController隱藏動畫
- 5. 從swift代碼訪問UITabBarController
- 6. ios 7 bottomLayoutGuide with uitabbarcontroller
- 7. UITabBarController圖像iOS 5
- 8. Tab導航iOS
- 9. iOS swift - 以編程方式進入下一個自定義UITabBarController
- 10. Go Server Not Starting
- 11. Windows services not Starting
- 12. IntentService onHandleEvent()not starting
- 13. Heroku resque starting workers
- 14. PySide QPropertyAnimation Not Starting
- 15. Starting gitk Error
- 16. NSURLDownload not starting
- 17. Rails Routes Starting Slash
- 18. WCF Services Not Starting
- 19. Resque worker not starting
- 20. iOS Tab Bar問題
- 21. iOS 5 UITabBarController中的UISplitViewController
- 22. iOS - 從UITabBarController提供ABUnknownPersonViewController
- 23. UITabBarController的定位問題iOS
- 24. iOS,UITabBarController中的問題
- 25. ios uiviewcontroller uitabbarcontroller的孩子
- 26. iOS 5和iOS 6 UITabBarController MoreNavigationViewController rotation
- 27. Android Studio Emultor Not Starting
- 28. C++ while loop not starting
- 29. AudioKit 4.0 AKPeriodicFunctions Not Starting
- 30. Swift 3:UITabBarController更改標籤展開
好的快,乾淨:) – Appyx