swift - 如何在注销时返回iPhone App的第一屏?

标签 swift ios8 heap-memory xcode6.1

我有一个应用程序,其结构在附图中定义。

基本上,我有一个登录 View Controller 作为 Root View Controller 。当用户登录时,应用会转到 TabbarController,然后从那里转到 Home View Controller。还有另外三个选项卡。现在有一个 Log Out 按钮点击哪个用户应该去登录 View Controller 但是如果我编写代码弹出到 Root View Controller 他们将去任何选项卡的 Root View Controller 但不是在登录屏幕上。

enter image description here

如何 POP 到登录 View Controller ?

我不想创建 SignInViewController 的新对象,因此 Push 对我不起作用,而且会占用大量内存。

我在 Xcode 6.1 中使用 Swift

最佳答案

您必须将 SignInViewController 作为 Root View Controller 。

  1. 删除登录凭据。
  2. 并将 SignInViewController 作为 Root View Controller 加载。

注意:在我的场景中,工作流程在 ARC 模式下效果最佳。因为在 ARC 模式下,我们不必释放您已加载到内存中的所有 View Controller 。

关于swift - 如何在注销时返回iPhone App的第一屏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28579654/

相关文章:

swift - 为什么 UISearchBar 在 Swift 中跳下并覆盖/重叠第一行?

swift - 如何快速识别字符串中的大写和小写字符?

ios - 在进行最小滚动或点击之前,单元格不会显示在表格 View 中(注意 : nothing happens on a background thread)

java - 这两个 Java 代码哪个更快?

java - 如何处理java.lang.OutOfMemoryError : Java heap space error on Google App Engine?

c++ - 内存分配是系统调用吗?

swift - 如何获得一个数的指数值?

xcode - 我可以用来提交到应用商店的最低 Xcode 版本是多少

ios - 快速播放录制的音频

ios - 无法打开 Optional.Swift 中的 None 错误