UITabBarController 选项卡充当注销按钮,而不是显示相应的视图

发布于 2024-10-07 08:22:39 字数 261 浏览 0 评论 0原文

我有一个基于 UITabBarController 的 iPhone 应用程序。我通过 Interface Builder 添加了一个名为“注销”的新选项卡。

但是我不需要它相应的视图。我希望“注销”选项卡在单击后立即重定向到“登录”视图(当然也会执行一些会话清除代码)。

到目前为止,我得到的最接近的是使用 viewWillAppear 从注销视图重定向。结果是相同的,但看起来不太好,因为它会进入空白屏幕几秒钟,然后重定向到登录屏幕。

任何帮助将不胜感激。

I have a UITabBarController based iphone application. I added a new tab called Log Out via the Interface Builder.

However I don't need its corresponding view. I want the Log Out tab to redirect to the Login view as soon as it is clicked (of course some session clearing code is executed as well).

The nearest I've got so far is to redirect from the Log Out View using the viewWillAppear. The result is the same but it doesnt look great because it goes into a blank screen for a couple of seconds and then it redirect to the login screen.

Any help would be appreciated.

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

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

发布评论

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

评论(1

狂之美人 2024-10-14 08:22:39

您可以使用 UITabbarDelegate 方法来完成此

操作使用以下委托方法检查注销按钮索引,如果找到则执行您的任务

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{

       if (tabBarController.selectedIndex == 4)
       {
         // perform logout tasks
       }


}

You can use UITabbarDelegate methods to accomplish this

Use following delegate method to check for logout buttons index and if found then perform your tasks

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{

       if (tabBarController.selectedIndex == 4)
       {
         // perform logout tasks
       }


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