presentViewController does not show Tab Bar or Navigation Bar

前端 未结 1 1360
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-28 06:40

I am new to Swift and have been struggling with this for a while.

I am trying to redirect users based on login status to either \"Login\" viewcontroller or \"Home\" vie

相关标签:
1条回答
  • 2021-01-28 07:21

    Your problem has nothing to do with being new to swift; it has to do with not understanding storyboards. If you instantiate HomeViewController, and present it, then that's all you will get. The fact that it's embedded in a tab bar controller and navigation controller in the storyboard is not "known" to this bare controller you just instantiated. You should instantiate the tab bar controller instead, and present it. It will take care of instantiating any of its children, and the navigation controller will take care of instantiating its root view controller.

    0 讨论(0)
提交回复
热议问题