如何向 iPhone 应用程序添加注销功能?

发布于 2024-10-05 06:46:52 字数 239 浏览 0 评论 0原文

我有一个具有以下布局的应用程序:

当您打开该应用程序时,您会看到一个登录屏幕。您登录后会看到一个包含 3 个选项卡的选项卡栏。 (登录视图在选项卡栏的appdelegate中显示为presentModalView)。

在第三个选项卡中有一个注销按钮。我希望当按下注销按钮时应用程序删除 NSUserDefaults 并再次显示登录视图。如果您再次登录,登录屏幕就会消失,您会看到选项卡栏的第一个选项卡。

我该怎么做?

I've an app with this layout:

When you open the app you see a login screen. You log in and you see a tabbar with 3 tabs. (The loginview is displayed with a presentModalView in the appdelegate of tabbar).

In the third tab there is a logout button. I want when logout button is pressed the app delete NSUserDefaults and shows the loginview again. And if you login again the login screen disappear and you see the first tab of the tabbar.

How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情徒 2024-10-12 06:46:52

执行以下操作,

  1. 将您的登录视图放置在第一个视图控制器中。

  2. 将标签栏控制器放置在第二个视图控制器中。

  3. 将第二个 viewcontroller 实例存储在 appDelegate 中(这将用于导航)。

  4. 现在,当按下注销按钮时,使用存储的实例导航您的视图。

Do as follows,

  1. Place your login view in first view controller.

  2. Place your tabbar controller in second view controller.

  3. Store the second viewcontroller instance in appDelegate (this will be used for navigation).

  4. Now when the logout button is pressed,use the stored instance navigate your view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文