【问题标题】:swift - I want to go back to previous viewController which in TabBarControllerswift - 我想回到 TabBarController 中的前一个 viewController
【发布时间】:2015-11-06 16:31:09
【问题描述】:

注册后我想回到TabBarController中的用户viewController,但是当我回到tabBarController中的控制器时,底部没有tabBar。

这是我的代码

 let MyPage = self.storyboard?.instantiateViewControllerWithIdentifier("MyViewController")

 presentViewController(MyPage!, animated: true, completion: nil)

MyViewController 是 TabBarController 中的第五个视图控制器

请告诉我如何去tabBarController中的一个视图控制器,非常感谢!

【问题讨论】:

  • MyViewController 是 TabBarController 吗?
  • @rnsjtngus MyViewController 是 TabBarController 中的第五个视图控制器
  • 你在每个标签上都有导航控制器吗?
  • 如果您在每个选项卡上都有 navigationController,请将 presentViewController 函数替换为 self.navigationController?.pushViewController 函数
  • 我没有navigationController。

标签: swift uitabbarcontroller


【解决方案1】:

不要使用presentViewController函数,而是使用dismissViewControllerAnimated函数。

替换

self.presentViewController(MyPage, animated: true, completion: nil)

self.dismissViewControllerAnimated(true, completion: nil)

【讨论】:

  • 我想在回到这个控制器的时候显示TabBar,但是我没有找到tabBarController的一个成员叫tabBar,我现在用的是Xcode 7。
  • 你必须关闭你当前的 viewController。不存在新的 viewController
  • 我改变了我的答案。检查一下
  • 好。请选择我的答案:)
猜你喜欢
  • 2017-10-22
  • 2016-03-03
  • 1970-01-01
  • 1970-01-01
  • 2020-06-18
  • 1970-01-01
  • 1970-01-01
  • 2018-12-15
  • 2017-07-03
相关资源
最近更新 更多