iOS选项卡式应用程序具有表视图,如何重置表视图选项卡?初学者. [英] iOS tabbed application with table view, how to reset table view tab? Beginner.

查看:85
本文介绍了iOS选项卡式应用程序具有表视图,如何重置表视图选项卡?初学者.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有3个标签的选项卡式应用程序

I have a tabbed application with 3 tabs

第一个标签是表格视图 第二个和第三个标签是单页浏览

The first tab is a table view The second and third tabs are single page views

当用户在一个视图中单击一个表格单元时,将使用向后的按钮将新视图推到该表格单元.

When a user clicks on a table cell in view one a new view is pushed on with a back button to the table cell.

现在让我们说他们单击选项卡2,然后返回到选项卡1.仍然可以看到在选项卡1上推送的新视图.我想要的是让表视图重置",当他们使用另一个选项卡离开它时,以便在他们返回时向他们提供表视图,而不是按下的新视图.

Now lets say they click tab 2, then back to tab 1. The new view that was pushed on tab 1 is still visible. What I would like is to have the table view "reset" when they navigate away from it with another tab so that when they return they are presented with the table view instead of the new view that was pushed on .

推荐答案

我同意ElJay的评论,但要使用UITabBarControllerDelegate来回答问题

I agree with ElJay comment, but to answer the question use UITabBarControllerDelegate

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController

在选择一个新选项卡时,请查看当前选项卡是否为tabBarController的选项卡1 selectedIndex属性,如果是,则为popToRootViewController:

when a new tab is selected see if the current one is tab 1 selectedIndex property of tabBarController and if so popToRootViewController:

这篇关于iOS选项卡式应用程序具有表视图,如何重置表视图选项卡?初学者.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆